diff options
4 files changed, 27 insertions, 10 deletions
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index f82e289..a7c4e8d 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs | |||
@@ -396,6 +396,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
396 | } | 396 | } |
397 | 397 | ||
398 | public abstract Vector3 Velocity { get; set; } | 398 | public abstract Vector3 Velocity { get; set; } |
399 | public virtual Vector3 rootVelocity { get; } | ||
399 | 400 | ||
400 | public abstract Vector3 Torque { get; set; } | 401 | public abstract Vector3 Torque { get; set; } |
401 | public abstract float CollisionScore { get; set;} | 402 | public abstract float CollisionScore { get; set;} |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 1b03b3c..fc01805 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | |||
@@ -607,6 +607,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
607 | set { return; } | 607 | set { return; } |
608 | } | 608 | } |
609 | 609 | ||
610 | public Vector3 rootVelocity | ||
611 | { | ||
612 | get | ||
613 | { | ||
614 | return _velocity; | ||
615 | } | ||
616 | } | ||
617 | |||
610 | public override Vector3 Velocity | 618 | public override Vector3 Velocity |
611 | { | 619 | { |
612 | get | 620 | get |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 437440c..21efa97 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -542,13 +542,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
542 | } | 542 | } |
543 | } | 543 | } |
544 | 544 | ||
545 | public override Vector3 Velocity | 545 | public Vector3 rootVelocity |
546 | { | 546 | { |
547 | get | 547 | get |
548 | { | 548 | { |
549 | if (_parent != null) | 549 | if(_parent != null) |
550 | return ((OdePrim)_parent).Velocity; | 550 | return ((OdePrim)_parent).Velocity; |
551 | return Velocity; | ||
552 | } | ||
553 | } | ||
551 | 554 | ||
555 | public override Vector3 Velocity | ||
556 | { | ||
557 | get | ||
558 | { | ||
552 | if (_zeroFlag) | 559 | if (_zeroFlag) |
553 | return Vector3.Zero; | 560 | return Vector3.Zero; |
554 | return _velocity; | 561 | return _velocity; |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index e475d84..ee80b10 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 (p1.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 | ||