diff options
author | John Hurliman | 2009-10-25 23:16:12 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-26 18:23:43 -0700 |
commit | d199767e6991d6f368661fce9c5a072e564b8a4b (patch) | |
tree | d9347b8a424c0164e208f908613aa8fe1511444b /OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |
parent | * Double the priority on avatar bake texture requests to get avatars rezzing ... (diff) | |
download | opensim-SC-d199767e6991d6f368661fce9c5a072e564b8a4b.zip opensim-SC-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.gz opensim-SC-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.bz2 opensim-SC-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.xz |
Experimental change of PhysicsVector to Vector3. Untested
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index abed8df..cbe73bb 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -52,14 +52,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
52 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 52 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | //Vector3 | 54 | //Vector3 |
55 | public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) | 55 | public static Vector3 PhysicsVectorToXnaVector3(OpenMetaverse.Vector3 physicsVector) |
56 | { | 56 | { |
57 | return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); | 57 | return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); |
58 | } | 58 | } |
59 | 59 | ||
60 | public static PhysicsVector XnaVector3ToPhysicsVector(Vector3 xnaVector3) | 60 | public static OpenMetaverse.Vector3 XnaVector3ToPhysicsVector(Vector3 xnaVector3) |
61 | { | 61 | { |
62 | return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); | 62 | return new OpenMetaverse.Vector3(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); |
63 | } | 63 | } |
64 | 64 | ||
65 | //Quaternion | 65 | //Quaternion |
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
349 | vertexBase = new Vector3[iVertexCount]; | 349 | vertexBase = new Vector3[iVertexCount]; |
350 | for (int i = 0; i < iVertexCount; i++) | 350 | for (int i = 0; i < iVertexCount; i++) |
351 | { | 351 | { |
352 | PhysicsVector v = mesh.getVertexList()[i]; | 352 | OpenMetaverse.Vector3 v = mesh.getVertexList()[i]; |
353 | if (v != null) // Note, null has special meaning. See meshing code for details | 353 | if (v != null) // Note, null has special meaning. See meshing code for details |
354 | vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); | 354 | vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); |
355 | else | 355 | else |
@@ -392,7 +392,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
392 | private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist) | 392 | private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist) |
393 | { | 393 | { |
394 | float fstartSide; | 394 | float fstartSide; |
395 | PhysicsVector v = actA.Position; | 395 | OpenMetaverse.Vector3 v = actA.Position; |
396 | Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); | 396 | Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); |
397 | 397 | ||
398 | fstartSide = Vector3.Dot(vNormal, v3) - fDist; | 398 | fstartSide = Vector3.Dot(vNormal, v3) - fDist; |
@@ -404,7 +404,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
404 | { | 404 | { |
405 | Vector3 perPlaneNormal; | 405 | Vector3 perPlaneNormal; |
406 | float fPerPlaneDist; | 406 | float fPerPlaneDist; |
407 | PhysicsVector v = actA.Position; | 407 | OpenMetaverse.Vector3 v = actA.Position; |
408 | Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); | 408 | Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); |
409 | //check AB | 409 | //check AB |
410 | Vector3 v1; | 410 | Vector3 v1; |
@@ -573,9 +573,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
573 | 573 | ||
574 | } | 574 | } |
575 | 575 | ||
576 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 576 | public override PhysicsActor AddAvatar(string avName, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, bool isFlying) |
577 | { | 577 | { |
578 | PhysicsVector pos = new PhysicsVector(); | 578 | OpenMetaverse.Vector3 pos = OpenMetaverse.Vector3.Zero; |
579 | pos.X = position.X; | 579 | pos.X = position.X; |
580 | pos.Y = position.Y; | 580 | pos.Y = position.Y; |
581 | pos.Z = position.Z + 20; | 581 | pos.Z = position.Z + 20; |
@@ -611,14 +611,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
611 | } | 611 | } |
612 | } | 612 | } |
613 | 613 | ||
614 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 614 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, |
615 | PhysicsVector size, OpenMetaverse.Quaternion rotation) | 615 | OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation) |
616 | { | 616 | { |
617 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 617 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
618 | } | 618 | } |
619 | 619 | ||
620 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 620 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, |
621 | PhysicsVector size, OpenMetaverse.Quaternion rotation, bool isPhysical) | 621 | OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical) |
622 | { | 622 | { |
623 | PhysicsActor result; | 623 | PhysicsActor result; |
624 | 624 | ||
@@ -645,7 +645,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
645 | return result; | 645 | return result; |
646 | } | 646 | } |
647 | 647 | ||
648 | public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, OpenMetaverse.Quaternion rotation, | 648 | public PhysicsActor AddPrim(String name, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, |
649 | IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) | 649 | IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) |
650 | { | 650 | { |
651 | BulletXPrim newPrim = null; | 651 | BulletXPrim newPrim = null; |
@@ -879,12 +879,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
879 | { | 879 | { |
880 | protected bool flying = false; | 880 | protected bool flying = false; |
881 | protected bool _physical = false; | 881 | protected bool _physical = false; |
882 | protected PhysicsVector _position; | 882 | protected OpenMetaverse.Vector3 _position; |
883 | protected PhysicsVector _velocity; | 883 | protected OpenMetaverse.Vector3 _velocity; |
884 | protected PhysicsVector _size; | 884 | protected OpenMetaverse.Vector3 _size; |
885 | protected PhysicsVector _acceleration; | 885 | protected OpenMetaverse.Vector3 _acceleration; |
886 | protected OpenMetaverse.Quaternion _orientation; | 886 | protected OpenMetaverse.Quaternion _orientation; |
887 | protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 887 | protected OpenMetaverse.Vector3 m_rotationalVelocity; |
888 | protected RigidBody rigidBody; | 888 | protected RigidBody rigidBody; |
889 | protected int m_PhysicsActorType; | 889 | protected int m_PhysicsActorType; |
890 | private Boolean iscolliding = false; | 890 | private Boolean iscolliding = false; |
@@ -900,7 +900,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
900 | get { return false; } | 900 | get { return false; } |
901 | } | 901 | } |
902 | 902 | ||
903 | public override PhysicsVector Position | 903 | public override OpenMetaverse.Vector3 Position |
904 | { | 904 | { |
905 | get { return _position; } | 905 | get { return _position; } |
906 | set | 906 | set |
@@ -913,13 +913,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
913 | } | 913 | } |
914 | } | 914 | } |
915 | 915 | ||
916 | public override PhysicsVector RotationalVelocity | 916 | public override OpenMetaverse.Vector3 RotationalVelocity |
917 | { | 917 | { |
918 | get { return m_rotationalVelocity; } | 918 | get { return m_rotationalVelocity; } |
919 | set { m_rotationalVelocity = value; } | 919 | set { m_rotationalVelocity = value; } |
920 | } | 920 | } |
921 | 921 | ||
922 | public override PhysicsVector Velocity | 922 | public override OpenMetaverse.Vector3 Velocity |
923 | { | 923 | { |
924 | get { return _velocity; } | 924 | get { return _velocity; } |
925 | set | 925 | set |
@@ -934,7 +934,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
934 | } | 934 | } |
935 | else | 935 | else |
936 | { | 936 | { |
937 | _velocity = new PhysicsVector(); | 937 | _velocity = OpenMetaverse.Vector3.Zero; |
938 | } | 938 | } |
939 | } | 939 | } |
940 | } | 940 | } |
@@ -944,7 +944,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
944 | get { return 0f; } | 944 | get { return 0f; } |
945 | set { } | 945 | set { } |
946 | } | 946 | } |
947 | public override PhysicsVector Size | 947 | public override OpenMetaverse.Vector3 Size |
948 | { | 948 | { |
949 | get { return _size; } | 949 | get { return _size; } |
950 | set | 950 | set |
@@ -956,9 +956,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
956 | } | 956 | } |
957 | } | 957 | } |
958 | 958 | ||
959 | public override PhysicsVector Force | 959 | public override OpenMetaverse.Vector3 Force |
960 | { | 960 | { |
961 | get { return PhysicsVector.Zero; } | 961 | get { return OpenMetaverse.Vector3.Zero; } |
962 | set { return; } | 962 | set { return; } |
963 | } | 963 | } |
964 | 964 | ||
@@ -973,7 +973,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
973 | 973 | ||
974 | } | 974 | } |
975 | 975 | ||
976 | public override void VehicleVectorParam(int param, PhysicsVector value) | 976 | public override void VehicleVectorParam(int param, OpenMetaverse.Vector3 value) |
977 | { | 977 | { |
978 | 978 | ||
979 | } | 979 | } |
@@ -988,14 +988,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
988 | 988 | ||
989 | } | 989 | } |
990 | 990 | ||
991 | public override PhysicsVector CenterOfMass | 991 | public override OpenMetaverse.Vector3 CenterOfMass |
992 | { | 992 | { |
993 | get { return PhysicsVector.Zero; } | 993 | get { return OpenMetaverse.Vector3.Zero; } |
994 | } | 994 | } |
995 | 995 | ||
996 | public override PhysicsVector GeometricCenter | 996 | public override OpenMetaverse.Vector3 GeometricCenter |
997 | { | 997 | { |
998 | get { return PhysicsVector.Zero; } | 998 | get { return OpenMetaverse.Vector3.Zero; } |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | public override PrimitiveBaseShape Shape | 1001 | public override PrimitiveBaseShape Shape |
@@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1009 | set { return; } | 1009 | set { return; } |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | public override PhysicsVector Acceleration | 1012 | public override OpenMetaverse.Vector3 Acceleration |
1013 | { | 1013 | { |
1014 | get { return _acceleration; } | 1014 | get { return _acceleration; } |
1015 | } | 1015 | } |
@@ -1036,7 +1036,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1036 | 1036 | ||
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | public override void LockAngularMotion(PhysicsVector axis) | 1039 | public override void LockAngularMotion(OpenMetaverse.Vector3 axis) |
1040 | { | 1040 | { |
1041 | 1041 | ||
1042 | } | 1042 | } |
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1129 | set { return; } | 1129 | set { return; } |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | public virtual void SetAcceleration(PhysicsVector accel) | 1132 | public virtual void SetAcceleration(OpenMetaverse.Vector3 accel) |
1133 | { | 1133 | { |
1134 | lock (BulletXScene.BulletXLock) | 1134 | lock (BulletXScene.BulletXLock) |
1135 | { | 1135 | { |
@@ -1143,19 +1143,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1143 | set { } | 1143 | set { } |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | public override void AddForce(PhysicsVector force, bool pushforce) | 1146 | public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce) |
1147 | { | 1147 | { |
1148 | } | 1148 | } |
1149 | public override PhysicsVector Torque | 1149 | public override OpenMetaverse.Vector3 Torque |
1150 | { | 1150 | { |
1151 | get { return PhysicsVector.Zero; } | 1151 | get { return OpenMetaverse.Vector3.Zero; } |
1152 | set { return; } | 1152 | set { return; } |
1153 | } | 1153 | } |
1154 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 1154 | public override void AddAngularForce(OpenMetaverse.Vector3 force, bool pushforce) |
1155 | { | 1155 | { |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | public override void SetMomentum(PhysicsVector momentum) | 1158 | public override void SetMomentum(OpenMetaverse.Vector3 momentum) |
1159 | { | 1159 | { |
1160 | } | 1160 | } |
1161 | 1161 | ||
@@ -1174,7 +1174,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1174 | Translate(_position); | 1174 | Translate(_position); |
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | protected internal void Translate(PhysicsVector _newPos) | 1177 | protected internal void Translate(OpenMetaverse.Vector3 _newPos) |
1178 | { | 1178 | { |
1179 | Vector3 _translation; | 1179 | Vector3 _translation; |
1180 | _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; | 1180 | _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; |
@@ -1186,7 +1186,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1186 | Speed(_velocity); | 1186 | Speed(_velocity); |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | protected internal void Speed(PhysicsVector _newSpeed) | 1189 | protected internal void Speed(OpenMetaverse.Vector3 _newSpeed) |
1190 | { | 1190 | { |
1191 | Vector3 _speed; | 1191 | Vector3 _speed; |
1192 | _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); | 1192 | _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); |
@@ -1212,7 +1212,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1212 | ReSize(_size); | 1212 | ReSize(_size); |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | protected internal virtual void ReSize(PhysicsVector _newSize) | 1215 | protected internal virtual void ReSize(OpenMetaverse.Vector3 _newSize) |
1216 | { | 1216 | { |
1217 | } | 1217 | } |
1218 | 1218 | ||
@@ -1227,7 +1227,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1227 | { | 1227 | { |
1228 | 1228 | ||
1229 | } | 1229 | } |
1230 | public override PhysicsVector PIDTarget { set { return; } } | 1230 | public override OpenMetaverse.Vector3 PIDTarget { set { return; } } |
1231 | public override bool PIDActive { set { return; } } | 1231 | public override bool PIDActive { set { return; } } |
1232 | public override float PIDTau { set { return; } } | 1232 | public override float PIDTau { set { return; } } |
1233 | 1233 | ||
@@ -1256,19 +1256,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1256 | /// </summary> | 1256 | /// </summary> |
1257 | public class BulletXCharacter : BulletXActor | 1257 | public class BulletXCharacter : BulletXActor |
1258 | { | 1258 | { |
1259 | public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) | 1259 | public BulletXCharacter(BulletXScene parent_scene, OpenMetaverse.Vector3 pos) |
1260 | : this(String.Empty, parent_scene, pos) | 1260 | : this(String.Empty, parent_scene, pos) |
1261 | { | 1261 | { |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) | 1264 | public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos) |
1265 | : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), | 1265 | : this(avName, parent_scene, pos, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, |
1266 | OpenMetaverse.Quaternion.Identity) | 1266 | OpenMetaverse.Quaternion.Identity) |
1267 | { | 1267 | { |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 1270 | public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity, |
1271 | PhysicsVector size, PhysicsVector acceleration, OpenMetaverse.Quaternion orientation) | 1271 | OpenMetaverse.Vector3 size, OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion orientation) |
1272 | : base(avName) | 1272 | : base(avName) |
1273 | { | 1273 | { |
1274 | //This fields will be removed. They're temporal | 1274 | //This fields will be removed. They're temporal |
@@ -1323,25 +1323,25 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1323 | set { return; } | 1323 | set { return; } |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | public override PhysicsVector Position | 1326 | public override OpenMetaverse.Vector3 Position |
1327 | { | 1327 | { |
1328 | get { return base.Position; } | 1328 | get { return base.Position; } |
1329 | set { base.Position = value; } | 1329 | set { base.Position = value; } |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | public override PhysicsVector Velocity | 1332 | public override OpenMetaverse.Vector3 Velocity |
1333 | { | 1333 | { |
1334 | get { return base.Velocity; } | 1334 | get { return base.Velocity; } |
1335 | set { base.Velocity = value; } | 1335 | set { base.Velocity = value; } |
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | public override PhysicsVector Size | 1338 | public override OpenMetaverse.Vector3 Size |
1339 | { | 1339 | { |
1340 | get { return base.Size; } | 1340 | get { return base.Size; } |
1341 | set { base.Size = value; } | 1341 | set { base.Size = value; } |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | public override PhysicsVector Acceleration | 1344 | public override OpenMetaverse.Vector3 Acceleration |
1345 | { | 1345 | { |
1346 | get { return base.Acceleration; } | 1346 | get { return base.Acceleration; } |
1347 | } | 1347 | } |
@@ -1370,17 +1370,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1370 | set { base.Kinematic = value; } | 1370 | set { base.Kinematic = value; } |
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | public override void SetAcceleration(PhysicsVector accel) | 1373 | public override void SetAcceleration(OpenMetaverse.Vector3 accel) |
1374 | { | 1374 | { |
1375 | base.SetAcceleration(accel); | 1375 | base.SetAcceleration(accel); |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | public override void AddForce(PhysicsVector force, bool pushforce) | 1378 | public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce) |
1379 | { | 1379 | { |
1380 | base.AddForce(force, pushforce); | 1380 | base.AddForce(force, pushforce); |
1381 | } | 1381 | } |
1382 | 1382 | ||
1383 | public override void SetMomentum(PhysicsVector momentum) | 1383 | public override void SetMomentum(OpenMetaverse.Vector3 momentum) |
1384 | { | 1384 | { |
1385 | base.SetMomentum(momentum); | 1385 | base.SetMomentum(momentum); |
1386 | } | 1386 | } |
@@ -1430,7 +1430,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1430 | m.Translation = v3; | 1430 | m.Translation = v3; |
1431 | rigidBody.WorldTransform = m; | 1431 | rigidBody.WorldTransform = m; |
1432 | //When an Avie touch the ground it's vertical velocity it's reduced to ZERO | 1432 | //When an Avie touch the ground it's vertical velocity it's reduced to ZERO |
1433 | Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); | 1433 | Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); |
1434 | } | 1434 | } |
1435 | } | 1435 | } |
1436 | 1436 | ||
@@ -1452,7 +1452,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1452 | //For now all prims have the same density, all prims are made of water. Be water my friend! :D | 1452 | //For now all prims have the same density, all prims are made of water. Be water my friend! :D |
1453 | private const float _density = 1000.0f; | 1453 | private const float _density = 1000.0f; |
1454 | private BulletXScene _parent_scene; | 1454 | private BulletXScene _parent_scene; |
1455 | private PhysicsVector m_prev_position = new PhysicsVector(0, 0, 0); | 1455 | private OpenMetaverse.Vector3 m_prev_position; |
1456 | private bool m_lastUpdateSent = false; | 1456 | private bool m_lastUpdateSent = false; |
1457 | //added by jed zhu | 1457 | //added by jed zhu |
1458 | private IMesh _mesh; | 1458 | private IMesh _mesh; |
@@ -1460,17 +1460,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1460 | 1460 | ||
1461 | 1461 | ||
1462 | 1462 | ||
1463 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, | 1463 | public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 size, |
1464 | OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) | 1464 | OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) |
1465 | : this( | 1465 | : this( |
1466 | primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs, | 1466 | primName, parent_scene, pos, OpenMetaverse.Vector3.Zero, size, OpenMetaverse.Vector3.Zero, rotation, mesh, pbs, |
1467 | isPhysical) | 1467 | isPhysical) |
1468 | { | 1468 | { |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 1471 | public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity, |
1472 | PhysicsVector size, | 1472 | OpenMetaverse.Vector3 size, |
1473 | PhysicsVector acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, | 1473 | OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, |
1474 | bool isPhysical) | 1474 | bool isPhysical) |
1475 | : base(primName) | 1475 | : base(primName) |
1476 | { | 1476 | { |
@@ -1481,7 +1481,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1481 | 1481 | ||
1482 | _position = pos; | 1482 | _position = pos; |
1483 | _physical = isPhysical; | 1483 | _physical = isPhysical; |
1484 | _velocity = _physical ? velocity : new PhysicsVector(); | 1484 | _velocity = _physical ? velocity : OpenMetaverse.Vector3.Zero; |
1485 | _size = size; | 1485 | _size = size; |
1486 | _acceleration = acceleration; | 1486 | _acceleration = acceleration; |
1487 | _orientation = rotation; | 1487 | _orientation = rotation; |
@@ -1497,19 +1497,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1497 | set { return; } | 1497 | set { return; } |
1498 | } | 1498 | } |
1499 | 1499 | ||
1500 | public override PhysicsVector Position | 1500 | public override OpenMetaverse.Vector3 Position |
1501 | { | 1501 | { |
1502 | get { return base.Position; } | 1502 | get { return base.Position; } |
1503 | set { base.Position = value; } | 1503 | set { base.Position = value; } |
1504 | } | 1504 | } |
1505 | 1505 | ||
1506 | public override PhysicsVector Velocity | 1506 | public override OpenMetaverse.Vector3 Velocity |
1507 | { | 1507 | { |
1508 | get { return base.Velocity; } | 1508 | get { return base.Velocity; } |
1509 | set { base.Velocity = value; } | 1509 | set { base.Velocity = value; } |
1510 | } | 1510 | } |
1511 | 1511 | ||
1512 | public override PhysicsVector Size | 1512 | public override OpenMetaverse.Vector3 Size |
1513 | { | 1513 | { |
1514 | get { return _size; } | 1514 | get { return _size; } |
1515 | set | 1515 | set |
@@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1522 | } | 1522 | } |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | public override PhysicsVector Acceleration | 1525 | public override OpenMetaverse.Vector3 Acceleration |
1526 | { | 1526 | { |
1527 | get { return base.Acceleration; } | 1527 | get { return base.Acceleration; } |
1528 | } | 1528 | } |
@@ -1583,7 +1583,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1583 | set { base.Kinematic = value; } | 1583 | set { base.Kinematic = value; } |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | public override void SetAcceleration(PhysicsVector accel) | 1586 | public override void SetAcceleration(OpenMetaverse.Vector3 accel) |
1587 | { | 1587 | { |
1588 | lock (BulletXScene.BulletXLock) | 1588 | lock (BulletXScene.BulletXLock) |
1589 | { | 1589 | { |
@@ -1591,12 +1591,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1591 | } | 1591 | } |
1592 | } | 1592 | } |
1593 | 1593 | ||
1594 | public override void AddForce(PhysicsVector force, bool pushforce) | 1594 | public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce) |
1595 | { | 1595 | { |
1596 | base.AddForce(force,pushforce); | 1596 | base.AddForce(force,pushforce); |
1597 | } | 1597 | } |
1598 | 1598 | ||
1599 | public override void SetMomentum(PhysicsVector momentum) | 1599 | public override void SetMomentum(OpenMetaverse.Vector3 momentum) |
1600 | { | 1600 | { |
1601 | base.SetMomentum(momentum); | 1601 | base.SetMomentum(momentum); |
1602 | } | 1602 | } |
@@ -1613,7 +1613,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1613 | //When a Prim touch the ground it's vertical velocity it's reduced to ZERO | 1613 | //When a Prim touch the ground it's vertical velocity it's reduced to ZERO |
1614 | //Static objects don't have linear velocity | 1614 | //Static objects don't have linear velocity |
1615 | if (_physical) | 1615 | if (_physical) |
1616 | Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); | 1616 | Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); |
1617 | } | 1617 | } |
1618 | } | 1618 | } |
1619 | 1619 | ||
@@ -1632,7 +1632,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1632 | { | 1632 | { |
1633 | if (!m_lastUpdateSent) | 1633 | if (!m_lastUpdateSent) |
1634 | { | 1634 | { |
1635 | _velocity = new PhysicsVector(0, 0, 0); | 1635 | _velocity = OpenMetaverse.Vector3.Zero; |
1636 | base.ScheduleTerseUpdate(); | 1636 | base.ScheduleTerseUpdate(); |
1637 | m_lastUpdateSent = true; | 1637 | m_lastUpdateSent = true; |
1638 | } | 1638 | } |
@@ -1654,8 +1654,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1654 | 1654 | ||
1655 | #region Methods for updating values of RigidBody | 1655 | #region Methods for updating values of RigidBody |
1656 | 1656 | ||
1657 | protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, PhysicsVector pos, | 1657 | protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, OpenMetaverse.Vector3 pos, |
1658 | PhysicsVector size) | 1658 | OpenMetaverse.Vector3 size) |
1659 | { | 1659 | { |
1660 | //For RigidBody Constructor. The next values might change | 1660 | //For RigidBody Constructor. The next values might change |
1661 | float _linearDamping = 0.0f; | 1661 | float _linearDamping = 0.0f; |
@@ -1683,7 +1683,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1683 | Vector3[] v3Vertices = new Vector3[iVertexCount]; | 1683 | Vector3[] v3Vertices = new Vector3[iVertexCount]; |
1684 | for (int i = 0; i < iVertexCount; i++) | 1684 | for (int i = 0; i < iVertexCount; i++) |
1685 | { | 1685 | { |
1686 | PhysicsVector v = mesh.getVertexList()[i]; | 1686 | OpenMetaverse.Vector3 v = mesh.getVertexList()[i]; |
1687 | if (v != null) // Note, null has special meaning. See meshing code for details | 1687 | if (v != null) // Note, null has special meaning. See meshing code for details |
1688 | v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); | 1688 | v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); |
1689 | else | 1689 | else |
@@ -1709,7 +1709,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1709 | } | 1709 | } |
1710 | } | 1710 | } |
1711 | 1711 | ||
1712 | protected internal void ReCreateRigidBody(PhysicsVector size) | 1712 | protected internal void ReCreateRigidBody(OpenMetaverse.Vector3 size) |
1713 | { | 1713 | { |
1714 | //There is a bug when trying to remove a rigidBody that is colliding with something.. | 1714 | //There is a bug when trying to remove a rigidBody that is colliding with something.. |
1715 | try | 1715 | try |
@@ -1729,7 +1729,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1729 | GC.Collect(); | 1729 | GC.Collect(); |
1730 | } | 1730 | } |
1731 | 1731 | ||
1732 | protected internal override void ReSize(PhysicsVector _newSize) | 1732 | protected internal override void ReSize(OpenMetaverse.Vector3 _newSize) |
1733 | { | 1733 | { |
1734 | //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't | 1734 | //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't |
1735 | //so i have to do it manually. That's recreating rigidbody | 1735 | //so i have to do it manually. That's recreating rigidbody |
@@ -1744,8 +1744,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1744 | /// </summary> | 1744 | /// </summary> |
1745 | internal class BulletXPlanet | 1745 | internal class BulletXPlanet |
1746 | { | 1746 | { |
1747 | private PhysicsVector _staticPosition; | 1747 | private OpenMetaverse.Vector3 _staticPosition; |
1748 | // private PhysicsVector _staticVelocity; | 1748 | // private Vector3 _staticVelocity; |
1749 | // private OpenMetaverse.Quaternion _staticOrientation; | 1749 | // private OpenMetaverse.Quaternion _staticOrientation; |
1750 | private float _mass; | 1750 | private float _mass; |
1751 | // private BulletXScene _parentscene; | 1751 | // private BulletXScene _parentscene; |
@@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1759 | 1759 | ||
1760 | internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) | 1760 | internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) |
1761 | { | 1761 | { |
1762 | _staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0); | 1762 | _staticPosition = new OpenMetaverse.Vector3(BulletXScene.MaxXY / 2, BulletXScene.MaxXY / 2, 0); |
1763 | // _staticVelocity = new PhysicsVector(); | 1763 | // _staticVelocity = new PhysicsVector(); |
1764 | // _staticOrientation = OpenMetaverse.Quaternion.Identity; | 1764 | // _staticOrientation = OpenMetaverse.Quaternion.Identity; |
1765 | _mass = 0; //No active | 1765 | _mass = 0; //No active |