diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index e0644e3..8d87c30 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -874,7 +874,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
874 | break; | 874 | break; |
875 | 875 | ||
876 | case (int)ActorTypes.Prim: | 876 | case (int)ActorTypes.Prim: |
877 | Vector3 relV = p1.Velocity - p2.Velocity; | 877 | Vector3 relV = p1.rootVelocity - p2.rootVelocity; |
878 | float relVlenSQ = relV.LengthSquared(); | 878 | float relVlenSQ = relV.LengthSquared(); |
879 | if (relVlenSQ > 0.0001f) | 879 | if (relVlenSQ > 0.0001f) |
880 | { | 880 | { |
@@ -899,7 +899,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
899 | bounce = contactdata1.bounce * TerrainBounce; | 899 | bounce = contactdata1.bounce * TerrainBounce; |
900 | mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); | 900 | mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); |
901 | 901 | ||
902 | if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) | 902 | Vector3 v1 = p1.rootVelocity; |
903 | if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f) | ||
903 | mu *= frictionMovementMult; | 904 | mu *= frictionMovementMult; |
904 | p1.CollidingGround = true; | 905 | p1.CollidingGround = true; |
905 | 906 | ||
@@ -925,8 +926,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
925 | 926 | ||
926 | // if (curContact.side1 > 0) // should be 2 ? | 927 | // if (curContact.side1 > 0) // should be 2 ? |
927 | // IgnoreNegSides = true; | 928 | // IgnoreNegSides = true; |
928 | 929 | Vector3 v2 = p2.rootVelocity; | |
929 | if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f) | 930 | if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f) |
930 | mu *= frictionMovementMult; | 931 | mu *= frictionMovementMult; |
931 | 932 | ||
932 | if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass) | 933 | if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass) |
@@ -980,7 +981,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
980 | p1.CollidingObj = true; | 981 | p1.CollidingObj = true; |
981 | p2.CollidingObj = true; | 982 | p2.CollidingObj = true; |
982 | } | 983 | } |
983 | else if (p2.Velocity.LengthSquared() > 0.0f) | 984 | else if (p2.rootVelocity.LengthSquared() > 0.0f) |
984 | p2.CollidingObj = true; | 985 | p2.CollidingObj = true; |
985 | } | 986 | } |
986 | else | 987 | else |
@@ -995,7 +996,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
995 | p1.CollidingObj = true; | 996 | p1.CollidingObj = true; |
996 | p2.CollidingObj = true; | 997 | p2.CollidingObj = true; |
997 | } | 998 | } |
998 | else if (p2.Velocity.LengthSquared() > 0.0f) | 999 | else if (p1.rootVelocity.LengthSquared() > 0.0f) |
999 | p1.CollidingObj = true; | 1000 | p1.CollidingObj = true; |
1000 | } | 1001 | } |
1001 | else | 1002 | else |
@@ -1068,10 +1069,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1068 | 1069 | ||
1069 | Vector3 vel = Vector3.Zero; | 1070 | Vector3 vel = Vector3.Zero; |
1070 | if (p2 != null && p2.IsPhysical) | 1071 | if (p2 != null && p2.IsPhysical) |
1071 | vel = p2.Velocity; | 1072 | vel = p2.rootVelocity; |
1072 | 1073 | ||
1073 | if (p1 != null && p1.IsPhysical) | 1074 | if (p1 != null && p1.IsPhysical) |
1074 | vel -= p1.Velocity; | 1075 | vel -= p1.rootVelocity; |
1075 | 1076 | ||
1076 | contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal); | 1077 | contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal); |
1077 | 1078 | ||
@@ -1079,44 +1080,45 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1079 | { | 1080 | { |
1080 | case ActorTypes.Agent: | 1081 | case ActorTypes.Agent: |
1081 | case ActorTypes.Prim: | 1082 | case ActorTypes.Prim: |
1083 | { | ||
1084 | switch ((ActorTypes)p2.PhysicsActorType) | ||
1082 | { | 1085 | { |
1083 | switch ((ActorTypes)p2.PhysicsActorType) | 1086 | case ActorTypes.Agent: |
1084 | { | 1087 | case ActorTypes.Prim: |
1085 | case ActorTypes.Agent: | 1088 | if (p2events) |
1086 | case ActorTypes.Prim: | 1089 | { |
1087 | if (p2events) | 1090 | AddCollisionEventReporting(p2); |
1088 | { | 1091 | p2.AddCollisionEvent(p1.ParentActor.LocalID, contact); |
1089 | AddCollisionEventReporting(p2); | 1092 | } |
1090 | p2.AddCollisionEvent(p1.ParentActor.LocalID, contact); | 1093 | obj2LocalID = p2.ParentActor.LocalID; |
1091 | } | 1094 | break; |
1092 | obj2LocalID = p2.ParentActor.LocalID; | ||
1093 | break; | ||
1094 | 1095 | ||
1095 | case ActorTypes.Ground: | 1096 | case ActorTypes.Ground: |
1096 | case ActorTypes.Unknown: | 1097 | case ActorTypes.Unknown: |
1097 | default: | 1098 | default: |
1098 | obj2LocalID = 0; | 1099 | obj2LocalID = 0; |
1099 | break; | 1100 | break; |
1100 | } | ||
1101 | if (p1events) | ||
1102 | { | ||
1103 | contact.SurfaceNormal = -contact.SurfaceNormal; | ||
1104 | AddCollisionEventReporting(p1); | ||
1105 | p1.AddCollisionEvent(obj2LocalID, contact); | ||
1106 | } | ||
1107 | break; | ||
1108 | } | 1101 | } |
1102 | if (p1events) | ||
1103 | { | ||
1104 | contact.SurfaceNormal = -contact.SurfaceNormal; | ||
1105 | contact.RelativeSpeed = -contact.RelativeSpeed; | ||
1106 | AddCollisionEventReporting(p1); | ||
1107 | p1.AddCollisionEvent(obj2LocalID, contact); | ||
1108 | } | ||
1109 | break; | ||
1110 | } | ||
1109 | case ActorTypes.Ground: | 1111 | case ActorTypes.Ground: |
1110 | case ActorTypes.Unknown: | 1112 | case ActorTypes.Unknown: |
1111 | default: | 1113 | default: |
1114 | { | ||
1115 | if (p2events && !p2.IsVolumeDtc) | ||
1112 | { | 1116 | { |
1113 | if (p2events && !p2.IsVolumeDtc) | 1117 | AddCollisionEventReporting(p2); |
1114 | { | 1118 | p2.AddCollisionEvent(0, contact); |
1115 | AddCollisionEventReporting(p2); | ||
1116 | p2.AddCollisionEvent(0, contact); | ||
1117 | } | ||
1118 | break; | ||
1119 | } | 1119 | } |
1120 | break; | ||
1121 | } | ||
1120 | } | 1122 | } |
1121 | } | 1123 | } |
1122 | 1124 | ||
@@ -1722,8 +1724,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1722 | 1724 | ||
1723 | case ActorTypes.Prim: | 1725 | case ActorTypes.Prim: |
1724 | OdePrim pobj = (OdePrim)obj; | 1726 | OdePrim pobj = (OdePrim)obj; |
1725 | if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) | 1727 | if (!pobj.m_outbounds && (pobj.Body == IntPtr.Zero || d.BodyIsEnabled(pobj.Body))) |
1726 | if (!pobj.m_outbounds) | ||
1727 | { | 1728 | { |
1728 | pobj.AddCollisionFrameTime((int)(odetimestepMS)); | 1729 | pobj.AddCollisionFrameTime((int)(odetimestepMS)); |
1729 | pobj.SendCollisions(); | 1730 | pobj.SendCollisions(); |