diff options
author | Teravus Ovares | 2007-11-08 00:10:40 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-08 00:10:40 +0000 |
commit | 9e9dad1cde362de093d0d7e6c3e247ff00ceac96 (patch) | |
tree | 72b364a18532ee152cfbd72df0158b8a2e001464 | |
parent | set svn:eol-style (diff) | |
download | opensim-SC-9e9dad1cde362de093d0d7e6c3e247ff00ceac96.zip opensim-SC-9e9dad1cde362de093d0d7e6c3e247ff00ceac96.tar.gz opensim-SC-9e9dad1cde362de093d0d7e6c3e247ff00ceac96.tar.bz2 opensim-SC-9e9dad1cde362de093d0d7e6c3e247ff00ceac96.tar.xz |
* Added Rotational Velocity reporting for Client Interpolation to Terse Updates
* Added Angular Velocity reporting for smooth-ish rotations on object collisions
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityBase.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 54 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 14 |
10 files changed, 130 insertions, 30 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 11e6ae7..bd98041 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -409,7 +409,7 @@ namespace OpenSim.Framework | |||
409 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | 409 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
410 | LLQuaternion rotation); | 410 | LLQuaternion rotation); |
411 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | 411 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
412 | LLQuaternion rotation,LLVector3 velocity); | 412 | LLQuaternion rotation,LLVector3 velocity, LLVector3 rotationalvelocity); |
413 | 413 | ||
414 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); | 414 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); |
415 | void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); | 415 | void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); |
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index bbe07d2..14e1b39 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -1062,23 +1062,24 @@ namespace OpenSim.Region.ClientStack | |||
1062 | LLQuaternion rotation) | 1062 | LLQuaternion rotation) |
1063 | { | 1063 | { |
1064 | LLVector3 velocity = new LLVector3(0f,0f,0f); | 1064 | LLVector3 velocity = new LLVector3(0f,0f,0f); |
1065 | LLVector3 rotationalvelocity = new LLVector3(0f,0f,0f); | ||
1065 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 1066 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
1066 | terse.RegionData.RegionHandle = regionHandle; | 1067 | terse.RegionData.RegionHandle = regionHandle; |
1067 | terse.RegionData.TimeDilation = timeDilation; | 1068 | terse.RegionData.TimeDilation = timeDilation; |
1068 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1069 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
1069 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity); | 1070 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity); |
1070 | 1071 | ||
1071 | OutPacket(terse); | 1072 | OutPacket(terse); |
1072 | } | 1073 | } |
1073 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | 1074 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
1074 | LLQuaternion rotation, LLVector3 velocity) | 1075 | LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) |
1075 | { | 1076 | { |
1076 | 1077 | ||
1077 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 1078 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
1078 | terse.RegionData.RegionHandle = regionHandle; | 1079 | terse.RegionData.RegionHandle = regionHandle; |
1079 | terse.RegionData.TimeDilation = timeDilation; | 1080 | terse.RegionData.TimeDilation = timeDilation; |
1080 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1081 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
1081 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity); | 1082 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity); |
1082 | 1083 | ||
1083 | OutPacket(terse); | 1084 | OutPacket(terse); |
1084 | } | 1085 | } |
@@ -1184,7 +1185,7 @@ namespace OpenSim.Region.ClientStack | |||
1184 | /// <returns></returns> | 1185 | /// <returns></returns> |
1185 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, | 1186 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, |
1186 | LLVector3 position, | 1187 | LLVector3 position, |
1187 | LLQuaternion rotation, LLVector3 velocity) | 1188 | LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) |
1188 | { | 1189 | { |
1189 | uint ID = localID; | 1190 | uint ID = localID; |
1190 | byte[] bytes = new byte[60]; | 1191 | byte[] bytes = new byte[60]; |
@@ -1248,12 +1249,24 @@ namespace OpenSim.Region.ClientStack | |||
1248 | bytes[i++] = (byte) ((rw >> 8)%256); | 1249 | bytes[i++] = (byte) ((rw >> 8)%256); |
1249 | 1250 | ||
1250 | //rotation vel | 1251 | //rotation vel |
1251 | bytes[i++] = (byte) (ac%256); | 1252 | ushort rvelx, rvely, rvelz; |
1252 | bytes[i++] = (byte) ((ac >> 8)%256); | 1253 | Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z); |
1253 | bytes[i++] = (byte) (ac%256); | 1254 | |
1254 | bytes[i++] = (byte) ((ac >> 8)%256); | 1255 | rvel = rvel / 128.0f; |
1255 | bytes[i++] = (byte) (ac%256); | 1256 | rvel.x += 1; |
1256 | bytes[i++] = (byte) ((ac >> 8)%256); | 1257 | rvel.y += 1; |
1258 | rvel.z += 1; | ||
1259 | //vel | ||
1260 | rvelx = (ushort)(32768 * (rvel.x)); | ||
1261 | rvely = (ushort)(32768 * (rvel.y)); | ||
1262 | rvelz = (ushort)(32768 * (rvel.z)); | ||
1263 | |||
1264 | bytes[i++] = (byte)(rvelx % 256); | ||
1265 | bytes[i++] = (byte)((rvelx >> 8) % 256); | ||
1266 | bytes[i++] = (byte)(rvely % 256); | ||
1267 | bytes[i++] = (byte)((rvely >> 8) % 256); | ||
1268 | bytes[i++] = (byte)(rvelz % 256); | ||
1269 | bytes[i++] = (byte)((rvelz >> 8) % 256); | ||
1257 | 1270 | ||
1258 | dat.Data = bytes; | 1271 | dat.Data = bytes; |
1259 | return dat; | 1272 | return dat; |
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index d0cbcf6..1c21159 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -69,6 +69,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
69 | } | 69 | } |
70 | 70 | ||
71 | protected LLVector3 m_velocity; | 71 | protected LLVector3 m_velocity; |
72 | protected LLVector3 m_rotationalvelocity; | ||
72 | 73 | ||
73 | /// <summary> | 74 | /// <summary> |
74 | /// | 75 | /// |
@@ -106,7 +107,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
106 | m_velocity = new LLVector3(); | 107 | m_velocity = new LLVector3(); |
107 | Rotation = new Quaternion(); | 108 | Rotation = new Quaternion(); |
108 | m_name = "(basic entity)"; | 109 | m_name = "(basic entity)"; |
109 | 110 | m_rotationalvelocity = new LLVector3(0, 0, 0); | |
110 | m_children = new List<EntityBase>(); | 111 | m_children = new List<EntityBase>(); |
111 | } | 112 | } |
112 | 113 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 4c6865a..0e2b186 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -231,6 +231,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
231 | } | 231 | } |
232 | 232 | ||
233 | protected LLVector3 m_velocity; | 233 | protected LLVector3 m_velocity; |
234 | protected LLVector3 m_rotationalvelocity; | ||
234 | 235 | ||
235 | /// <summary></summary> | 236 | /// <summary></summary> |
236 | public LLVector3 Velocity | 237 | public LLVector3 Velocity |
@@ -253,6 +254,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
253 | } | 254 | } |
254 | set { m_velocity = value; } | 255 | set { m_velocity = value; } |
255 | } | 256 | } |
257 | public LLVector3 RotationalVelocity | ||
258 | { | ||
259 | get | ||
260 | { | ||
261 | //if (PhysActor.Velocity.x != 0 || PhysActor.Velocity.y != 0 | ||
262 | //|| PhysActor.Velocity.z != 0) | ||
263 | //{ | ||
264 | if (PhysActor != null) | ||
265 | { | ||
266 | if (PhysActor.IsPhysical) | ||
267 | { | ||
268 | m_rotationalvelocity.X = PhysActor.RotationalVelocity.X; | ||
269 | m_rotationalvelocity.Y = PhysActor.RotationalVelocity.Y; | ||
270 | m_rotationalvelocity.Z = PhysActor.RotationalVelocity.Z; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | return m_rotationalvelocity; | ||
275 | } | ||
276 | set { m_rotationalvelocity = value; } | ||
277 | } | ||
278 | |||
256 | 279 | ||
257 | protected LLVector3 m_angularVelocity; | 280 | protected LLVector3 m_angularVelocity; |
258 | 281 | ||
@@ -384,6 +407,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
384 | OffsetPosition = offsetPosition; | 407 | OffsetPosition = offsetPosition; |
385 | RotationOffset = rotationOffset; | 408 | RotationOffset = rotationOffset; |
386 | Velocity = new LLVector3(0, 0, 0); | 409 | Velocity = new LLVector3(0, 0, 0); |
410 | m_rotationalvelocity = new LLVector3(0, 0, 0); | ||
387 | AngularVelocity = new LLVector3(0, 0, 0); | 411 | AngularVelocity = new LLVector3(0, 0, 0); |
388 | Acceleration = new LLVector3(0, 0, 0); | 412 | Acceleration = new LLVector3(0, 0, 0); |
389 | 413 | ||
@@ -1020,7 +1044,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1020 | } | 1044 | } |
1021 | else | 1045 | else |
1022 | { | 1046 | { |
1023 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity); | 1047 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, RotationalVelocity); |
1024 | } | 1048 | } |
1025 | } | 1049 | } |
1026 | 1050 | ||
@@ -1033,8 +1057,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1033 | } | 1057 | } |
1034 | else | 1058 | else |
1035 | { | 1059 | { |
1036 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity); | 1060 | remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, RotationalVelocity); |
1037 | //System.Console.WriteLine("Vel:" + Velocity); | 1061 | //System.Console.WriteLine("RVel:" + RotationalVelocity); |
1038 | } | 1062 | } |
1039 | } | 1063 | } |
1040 | 1064 | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 1a7901e..75b3f04 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -282,7 +282,7 @@ namespace SimpleApp | |||
282 | { | 282 | { |
283 | } | 283 | } |
284 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, | 284 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, |
285 | LLVector3 position, LLQuaternion rotation,LLVector3 velocity) | 285 | LLVector3 position, LLQuaternion rotation,LLVector3 velocity, LLVector3 rotationalvelocity) |
286 | { | 286 | { |
287 | } | 287 | } |
288 | 288 | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 46037df..d5cb99f 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -181,6 +181,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
181 | private PhysicsVector _position; | 181 | private PhysicsVector _position; |
182 | private PhysicsVector _velocity; | 182 | private PhysicsVector _velocity; |
183 | private PhysicsVector _acceleration; | 183 | private PhysicsVector _acceleration; |
184 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | ||
184 | private bool flying; | 185 | private bool flying; |
185 | private bool iscolliding; | 186 | private bool iscolliding; |
186 | 187 | ||
@@ -190,7 +191,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
190 | _position = new PhysicsVector(); | 191 | _position = new PhysicsVector(); |
191 | _acceleration = new PhysicsVector(); | 192 | _acceleration = new PhysicsVector(); |
192 | } | 193 | } |
193 | 194 | public override PhysicsVector RotationalVelocity | |
195 | { | ||
196 | get { return m_rotationalVelocity; } | ||
197 | set { m_rotationalVelocity = value; } | ||
198 | } | ||
194 | public override bool IsPhysical | 199 | public override bool IsPhysical |
195 | { | 200 | { |
196 | get { return false; } | 201 | get { return false; } |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index efc99e4..cdccc70 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -643,6 +643,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
643 | protected PhysicsVector _size; | 643 | protected PhysicsVector _size; |
644 | protected PhysicsVector _acceleration; | 644 | protected PhysicsVector _acceleration; |
645 | protected AxiomQuaternion _orientation; | 645 | protected AxiomQuaternion _orientation; |
646 | protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | ||
646 | protected RigidBody rigidBody; | 647 | protected RigidBody rigidBody; |
647 | private Boolean iscolliding = false; | 648 | private Boolean iscolliding = false; |
648 | 649 | ||
@@ -662,6 +663,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
662 | } | 663 | } |
663 | } | 664 | } |
664 | } | 665 | } |
666 | public override PhysicsVector RotationalVelocity | ||
667 | { | ||
668 | get { return m_rotationalVelocity; } | ||
669 | set { m_rotationalVelocity = value; } | ||
670 | } | ||
665 | public override PhysicsVector Velocity | 671 | public override PhysicsVector Velocity |
666 | { | 672 | { |
667 | get { return _velocity; } | 673 | get { return _velocity; } |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index b151e16..2d8eb9a 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -36,6 +36,8 @@ namespace OpenSim.Region.Physics.Manager | |||
36 | 36 | ||
37 | public delegate void OrientationUpdate(Quaternion orientation); | 37 | public delegate void OrientationUpdate(Quaternion orientation); |
38 | 38 | ||
39 | |||
40 | |||
39 | public abstract class PhysicsActor | 41 | public abstract class PhysicsActor |
40 | { | 42 | { |
41 | #pragma warning disable 67 | 43 | #pragma warning disable 67 |
@@ -69,6 +71,7 @@ namespace OpenSim.Region.Physics.Manager | |||
69 | public abstract bool Flying { get; set; } | 71 | public abstract bool Flying { get; set; } |
70 | 72 | ||
71 | public abstract bool IsColliding { get; set; } | 73 | public abstract bool IsColliding { get; set; } |
74 | public abstract PhysicsVector RotationalVelocity { get; set; } | ||
72 | 75 | ||
73 | public abstract bool Kinematic { get; set; } | 76 | public abstract bool Kinematic { get; set; } |
74 | 77 | ||
@@ -144,7 +147,11 @@ namespace OpenSim.Region.Physics.Manager | |||
144 | { | 147 | { |
145 | return; | 148 | return; |
146 | } | 149 | } |
147 | 150 | public override PhysicsVector RotationalVelocity | |
151 | { | ||
152 | get { return PhysicsVector.Zero; } | ||
153 | set { return; } | ||
154 | } | ||
148 | public override void SetMomentum(PhysicsVector momentum) | 155 | public override void SetMomentum(PhysicsVector momentum) |
149 | { | 156 | { |
150 | return; | 157 | return; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 8b8aac6..512b96e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -617,6 +617,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
617 | private PhysicsVector _velocity; | 617 | private PhysicsVector _velocity; |
618 | private PhysicsVector _target_velocity; | 618 | private PhysicsVector _target_velocity; |
619 | private PhysicsVector _acceleration; | 619 | private PhysicsVector _acceleration; |
620 | private PhysicsVector m_rotationalVelocity; | ||
620 | private static float PID_D = 4000.0f; | 621 | private static float PID_D = 4000.0f; |
621 | private static float PID_P = 7000.0f; | 622 | private static float PID_P = 7000.0f; |
622 | private static float POSTURE_SERVO = 10000.0f; | 623 | private static float POSTURE_SERVO = 10000.0f; |
@@ -682,7 +683,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
682 | } | 683 | } |
683 | } | 684 | } |
684 | } | 685 | } |
685 | 686 | public override PhysicsVector RotationalVelocity | |
687 | { | ||
688 | get { return m_rotationalVelocity; } | ||
689 | set { m_rotationalVelocity = value; } | ||
690 | } | ||
686 | public override PhysicsVector Size | 691 | public override PhysicsVector Size |
687 | { | 692 | { |
688 | get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } | 693 | get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } |
@@ -858,6 +863,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
858 | private PhysicsVector _velocity; | 863 | private PhysicsVector _velocity; |
859 | private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f,0.0f,0.0f); | 864 | private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f,0.0f,0.0f); |
860 | private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); | 865 | private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); |
866 | private PhysicsVector m_rotationalVelocity; | ||
861 | private PhysicsVector _size; | 867 | private PhysicsVector _size; |
862 | private PhysicsVector _acceleration; | 868 | private PhysicsVector _acceleration; |
863 | public Quaternion _orientation; | 869 | public Quaternion _orientation; |
@@ -887,6 +893,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
887 | _position = pos; | 893 | _position = pos; |
888 | _size = size; | 894 | _size = size; |
889 | _acceleration = new PhysicsVector(); | 895 | _acceleration = new PhysicsVector(); |
896 | m_rotationalVelocity = PhysicsVector.Zero; | ||
890 | _orientation = rotation; | 897 | _orientation = rotation; |
891 | _mesh = mesh; | 898 | _mesh = mesh; |
892 | _pbs = pbs; | 899 | _pbs = pbs; |
@@ -1224,7 +1231,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1224 | } | 1231 | } |
1225 | public void Move(float timestep) | 1232 | public void Move(float timestep) |
1226 | { | 1233 | { |
1227 | 1234 | ||
1235 | } | ||
1236 | public override PhysicsVector RotationalVelocity | ||
1237 | { | ||
1238 | get{ return m_rotationalVelocity;} | ||
1239 | set { m_rotationalVelocity = value; } | ||
1228 | } | 1240 | } |
1229 | 1241 | ||
1230 | public void UpdatePositionAndVelocity() { | 1242 | public void UpdatePositionAndVelocity() { |
@@ -1234,6 +1246,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1234 | d.Vector3 vec = d.BodyGetPosition(Body); | 1246 | d.Vector3 vec = d.BodyGetPosition(Body); |
1235 | d.Quaternion ori = d.BodyGetQuaternion(Body); | 1247 | d.Quaternion ori = d.BodyGetQuaternion(Body); |
1236 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 1248 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
1249 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); | ||
1250 | |||
1237 | PhysicsVector l_position = new PhysicsVector(); | 1251 | PhysicsVector l_position = new PhysicsVector(); |
1238 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 1252 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
1239 | if (vec.X < 0.0f) vec.X = 0.0f; | 1253 | if (vec.X < 0.0f) vec.X = 0.0f; |
@@ -1256,7 +1270,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1256 | try | 1270 | try |
1257 | { | 1271 | { |
1258 | disableBody(); | 1272 | disableBody(); |
1259 | 1273 | ||
1260 | } | 1274 | } |
1261 | catch (System.Exception e) | 1275 | catch (System.Exception e) |
1262 | { | 1276 | { |
@@ -1264,13 +1278,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1264 | { | 1278 | { |
1265 | d.BodyDestroy(Body); | 1279 | d.BodyDestroy(Body); |
1266 | Body = (IntPtr)0; | 1280 | Body = (IntPtr)0; |
1267 | 1281 | ||
1268 | } | 1282 | } |
1269 | } | 1283 | } |
1270 | IsPhysical = false; | 1284 | IsPhysical = false; |
1271 | _velocity.X = 0; | 1285 | _velocity.X = 0; |
1272 | _velocity.Y = 0; | 1286 | _velocity.Y = 0; |
1273 | _velocity.Z = 0; | 1287 | _velocity.Z = 0; |
1288 | m_rotationalVelocity.X = 0; | ||
1289 | m_rotationalVelocity.Y = 0; | ||
1290 | m_rotationalVelocity.Z = 0; | ||
1274 | _zeroFlag = true; | 1291 | _zeroFlag = true; |
1275 | } | 1292 | } |
1276 | 1293 | ||
@@ -1293,11 +1310,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1293 | _velocity.X = 0.0f; | 1310 | _velocity.X = 0.0f; |
1294 | _velocity.Y = 0.0f; | 1311 | _velocity.Y = 0.0f; |
1295 | _velocity.Z = 0.0f; | 1312 | _velocity.Z = 0.0f; |
1296 | _orientation.w = 0f; | 1313 | //_orientation.w = 0f; |
1297 | _orientation.x = 0f; | 1314 | //_orientation.x = 0f; |
1298 | _orientation.y = 0f; | 1315 | //_orientation.y = 0f; |
1299 | _orientation.z = 0f; | 1316 | //_orientation.z = 0f; |
1300 | 1317 | m_rotationalVelocity.X = 0; | |
1318 | m_rotationalVelocity.Y = 0; | ||
1319 | m_rotationalVelocity.Z = 0; | ||
1301 | 1320 | ||
1302 | } | 1321 | } |
1303 | else | 1322 | else |
@@ -1310,6 +1329,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1310 | _velocity.Y = vel.Y; | 1329 | _velocity.Y = vel.Y; |
1311 | _velocity.Z = vel.Z; | 1330 | _velocity.Z = vel.Z; |
1312 | 1331 | ||
1332 | m_rotationalVelocity.X = rotvel.X; | ||
1333 | m_rotationalVelocity.Y = rotvel.Y; | ||
1334 | m_rotationalVelocity.Z = rotvel.Z; | ||
1335 | //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); | ||
1313 | _orientation.w = ori.W; | 1336 | _orientation.w = ori.W; |
1314 | _orientation.x = ori.X; | 1337 | _orientation.x = ori.X; |
1315 | _orientation.y = ori.Y; | 1338 | _orientation.y = ori.Y; |
@@ -1317,6 +1340,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1317 | } | 1340 | } |
1318 | 1341 | ||
1319 | } | 1342 | } |
1343 | else | ||
1344 | { | ||
1345 | // Not a body.. so Make sure the client isn't interpolating | ||
1346 | _velocity.X = 0; | ||
1347 | _velocity.Y = 0; | ||
1348 | _velocity.Z = 0; | ||
1349 | m_rotationalVelocity.X = 0; | ||
1350 | m_rotationalVelocity.Y = 0; | ||
1351 | m_rotationalVelocity.Z = 0; | ||
1352 | _zeroFlag = true; | ||
1353 | } | ||
1320 | 1354 | ||
1321 | } | 1355 | } |
1322 | public override void SetMomentum(PhysicsVector momentum) | 1356 | public override void SetMomentum(PhysicsVector momentum) |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 5483703..d282e9d 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -184,6 +184,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
184 | { | 184 | { |
185 | private PhysicsVector _position; | 185 | private PhysicsVector _position; |
186 | private PhysicsVector _velocity; | 186 | private PhysicsVector _velocity; |
187 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | ||
187 | private PhysicsVector _acceleration; | 188 | private PhysicsVector _acceleration; |
188 | private NxCharacter _character; | 189 | private NxCharacter _character; |
189 | private bool flying; | 190 | private bool flying; |
@@ -214,7 +215,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
214 | get { return iscolliding; } | 215 | get { return iscolliding; } |
215 | set { iscolliding = value; } | 216 | set { iscolliding = value; } |
216 | } | 217 | } |
217 | 218 | public override PhysicsVector RotationalVelocity | |
219 | { | ||
220 | get { return m_rotationalVelocity; } | ||
221 | set { m_rotationalVelocity = value; } | ||
222 | } | ||
218 | public override PhysicsVector Position | 223 | public override PhysicsVector Position |
219 | { | 224 | { |
220 | get { return _position; } | 225 | get { return _position; } |
@@ -314,6 +319,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
314 | private PhysicsVector _position; | 319 | private PhysicsVector _position; |
315 | private PhysicsVector _velocity; | 320 | private PhysicsVector _velocity; |
316 | private PhysicsVector _acceleration; | 321 | private PhysicsVector _acceleration; |
322 | private PhysicsVector m_rotationalVelocity; | ||
317 | private NxActor _prim; | 323 | private NxActor _prim; |
318 | 324 | ||
319 | public PhysXPrim(NxActor prim) | 325 | public PhysXPrim(NxActor prim) |
@@ -329,7 +335,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
329 | get { return false; } | 335 | get { return false; } |
330 | set { return; } | 336 | set { return; } |
331 | } | 337 | } |
332 | 338 | public override PhysicsVector RotationalVelocity | |
339 | { | ||
340 | get { return m_rotationalVelocity; } | ||
341 | set { m_rotationalVelocity = value; } | ||
342 | } | ||
333 | public override bool Flying | 343 | public override bool Flying |
334 | { | 344 | { |
335 | get { return false; //no flying prims for you | 345 | get { return false; //no flying prims for you |