diff options
author | Melanie | 2012-04-17 01:50:49 +0100 |
---|---|---|
committer | Melanie | 2012-04-17 01:50:49 +0100 |
commit | ab1a3688e24db08071f74c9804d552d5763bbeb2 (patch) | |
tree | 030bafc8ce646fbf80bd20a1e7647618222e7fc2 /OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'ubitwork' (diff) | |
download | opensim-SC-ab1a3688e24db08071f74c9804d552d5763bbeb2.zip opensim-SC-ab1a3688e24db08071f74c9804d552d5763bbeb2.tar.gz opensim-SC-ab1a3688e24db08071f74c9804d552d5763bbeb2.tar.bz2 opensim-SC-ab1a3688e24db08071f74c9804d552d5763bbeb2.tar.xz |
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 4266fda..9c1b87b 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -115,12 +115,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
115 | private CollisionCategories m_collisionCategories = (CollisionCategories.Character); | 115 | private CollisionCategories m_collisionCategories = (CollisionCategories.Character); |
116 | 116 | ||
117 | // Default, Collide with Other Geometries, spaces, bodies and characters. | 117 | // Default, Collide with Other Geometries, spaces, bodies and characters. |
118 | private CollisionCategories m_collisionFlags = (CollisionCategories.Geom | 118 | private CollisionCategories m_collisionFlags = (CollisionCategories.Character |
119 | | CollisionCategories.Space | 119 | | CollisionCategories.Geom |
120 | | CollisionCategories.Body | 120 | | CollisionCategories.VolumeDtc |
121 | | CollisionCategories.Character | ||
122 | ); | 121 | ); |
123 | // we do land collisions not ode | CollisionCategories.Land); | 122 | // we do land collisions not ode | CollisionCategories.Land); |
124 | public IntPtr Body = IntPtr.Zero; | 123 | public IntPtr Body = IntPtr.Zero; |
125 | private OdeScene _parent_scene; | 124 | private OdeScene _parent_scene; |
126 | public IntPtr Shell = IntPtr.Zero; | 125 | public IntPtr Shell = IntPtr.Zero; |
@@ -639,6 +638,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
639 | 638 | ||
640 | public override void SetMomentum(Vector3 momentum) | 639 | public override void SetMomentum(Vector3 momentum) |
641 | { | 640 | { |
641 | if (momentum.IsFinite()) | ||
642 | AddChange(changes.Momentum, momentum); | ||
642 | } | 643 | } |
643 | 644 | ||
644 | 645 | ||
@@ -663,8 +664,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
663 | } | 664 | } |
664 | Shell = d.CreateCapsule(_parent_scene.ActiveSpace, CAPSULE_RADIUS, CAPSULE_LENGTH); | 665 | Shell = d.CreateCapsule(_parent_scene.ActiveSpace, CAPSULE_RADIUS, CAPSULE_LENGTH); |
665 | 666 | ||
666 | d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); | 667 | d.GeomSetCategoryBits(Shell, (uint)m_collisionCategories); |
667 | d.GeomSetCollideBits(Shell, (int)m_collisionFlags); | 668 | d.GeomSetCollideBits(Shell, (uint)m_collisionFlags); |
668 | 669 | ||
669 | d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH); | 670 | d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH); |
670 | 671 | ||
@@ -759,7 +760,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
759 | _parent_scene.geom_name_map.Remove(Shell); | 760 | _parent_scene.geom_name_map.Remove(Shell); |
760 | _parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace); | 761 | _parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace); |
761 | d.GeomDestroy(Shell); | 762 | d.GeomDestroy(Shell); |
762 | _parent_scene.geom_name_map.Remove(Shell); | ||
763 | Shell = IntPtr.Zero; | 763 | Shell = IntPtr.Zero; |
764 | } | 764 | } |
765 | } | 765 | } |
@@ -991,6 +991,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
991 | // end add Kitto Flora | 991 | // end add Kitto Flora |
992 | } | 992 | } |
993 | 993 | ||
994 | if (vel.X * vel.X + vel.Y * vel.Y + vel.Z * vel.Z > 2500.0f) // 50m/s apply breaks | ||
995 | { | ||
996 | float breakfactor = 0.16f * m_mass; // will give aprox 60m/s terminal velocity at free fall | ||
997 | vec.X -= breakfactor * vel.X; | ||
998 | vec.Y -= breakfactor * vel.Y; | ||
999 | vec.Z -= breakfactor * vel.Z; | ||
1000 | } | ||
1001 | |||
994 | if (vec.IsFinite()) | 1002 | if (vec.IsFinite()) |
995 | { | 1003 | { |
996 | if (vec.X != 0 || vec.Y !=0 || vec.Z !=0) | 1004 | if (vec.X != 0 || vec.Y !=0 || vec.Z !=0) |
@@ -1324,6 +1332,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1324 | } | 1332 | } |
1325 | } | 1333 | } |
1326 | 1334 | ||
1335 | // for now momentum is actually velocity | ||
1336 | private void changeMomentum(Vector3 newmomentum) | ||
1337 | { | ||
1338 | _velocity = newmomentum; | ||
1339 | _target_velocity = newmomentum; | ||
1340 | m_pidControllerActive = true; | ||
1341 | if (Body != IntPtr.Zero) | ||
1342 | d.BodySetLinearVel(Body, newmomentum.X, newmomentum.Y, newmomentum.Z); | ||
1343 | } | ||
1344 | |||
1327 | private void donullchange() | 1345 | private void donullchange() |
1328 | { | 1346 | { |
1329 | } | 1347 | } |
@@ -1395,6 +1413,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1395 | case changes.Size: | 1413 | case changes.Size: |
1396 | changeSize((Vector3)arg); | 1414 | changeSize((Vector3)arg); |
1397 | break; | 1415 | break; |
1416 | |||
1417 | case changes.Momentum: | ||
1418 | changeMomentum((Vector3)arg); | ||
1419 | break; | ||
1398 | /* not in use for now | 1420 | /* not in use for now |
1399 | case changes.Shape: | 1421 | case changes.Shape: |
1400 | changeShape((PrimitiveBaseShape)arg); | 1422 | changeShape((PrimitiveBaseShape)arg); |