aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2012-07-10 05:11:06 +0100
committerUbitUmarov2012-07-10 05:11:06 +0100
commitca41ec9eb4616c0cb96ed48d591e473d95af2701 (patch)
tree9e22111644122211c7462181a2d4297d53d8f946 /OpenSim/Region
parent changed ODE lib for win32 to version 0.12 (diff)
downloadopensim-SC-ca41ec9eb4616c0cb96ed48d591e473d95af2701.zip
opensim-SC-ca41ec9eb4616c0cb96ed48d591e473d95af2701.tar.gz
opensim-SC-ca41ec9eb4616c0cb96ed48d591e473d95af2701.tar.bz2
opensim-SC-ca41ec9eb4616c0cb96ed48d591e473d95af2701.tar.xz
let rotationVelocity or AngularVelocity be setted on prims. Limited to
12rad/s
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs65
1 files changed, 46 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 3d8e680..14e4272 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -583,8 +583,6 @@ namespace OpenSim.Region.Physics.OdePlugin
583 if (value.IsFinite()) 583 if (value.IsFinite())
584 { 584 {
585 AddChange(changes.Velocity, value); 585 AddChange(changes.Velocity, value);
586// _velocity = value;
587
588 } 586 }
589 else 587 else
590 { 588 {
@@ -676,9 +674,7 @@ namespace OpenSim.Region.Physics.OdePlugin
676 { 674 {
677 if (value.IsFinite()) 675 if (value.IsFinite())
678 { 676 {
679 m_rotationalVelocity = value; 677 AddChange(changes.AngVelocity, value);
680 if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
681 d.BodyEnable(Body);
682 } 678 }
683 else 679 else
684 { 680 {
@@ -687,7 +683,6 @@ namespace OpenSim.Region.Physics.OdePlugin
687 } 683 }
688 } 684 }
689 685
690
691 public override float Buoyancy 686 public override float Buoyancy
692 { 687 {
693 get { return m_buoyancy; } 688 get { return m_buoyancy; }
@@ -1737,17 +1732,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1737 1732
1738 d.BodySetAutoDisableFlag(Body, true); 1733 d.BodySetAutoDisableFlag(Body, true);
1739 d.BodySetAutoDisableSteps(Body, body_autodisable_frames); 1734 d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
1740// d.BodySetLinearDampingThreshold(Body, 0.01f); 1735 d.BodySetDamping(Body, .005f, .005f);
1741// d.BodySetAngularDampingThreshold(Body, 0.001f);
1742 d.BodySetDamping(Body, .002f, .002f);
1743
1744 if (m_targetSpace != IntPtr.Zero)
1745 {
1746 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1747 if (d.SpaceQuery(m_targetSpace, prim_geom))
1748 d.SpaceRemove(m_targetSpace, prim_geom);
1749 }
1750 1736
1737 if (m_targetSpace != IntPtr.Zero)
1738 {
1739 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1740 if (d.SpaceQuery(m_targetSpace, prim_geom))
1741 d.SpaceRemove(m_targetSpace, prim_geom);
1742 }
1751 1743
1752 if (childrenPrim.Count == 0) 1744 if (childrenPrim.Count == 0)
1753 { 1745 {
@@ -3296,6 +3288,13 @@ namespace OpenSim.Region.Physics.OdePlugin
3296 3288
3297 private void changevelocity(Vector3 newVel) 3289 private void changevelocity(Vector3 newVel)
3298 { 3290 {
3291 float len = newVel.LengthSquared();
3292 if (len > 100000.0f) // limit to 100m/s
3293 {
3294 len = 100.0f / (float)Math.Sqrt(len);
3295 newVel *= len;
3296 }
3297
3299 if (!m_isSelected) 3298 if (!m_isSelected)
3300 { 3299 {
3301 if (Body != IntPtr.Zero) 3300 if (Body != IntPtr.Zero)
@@ -3312,6 +3311,33 @@ namespace OpenSim.Region.Physics.OdePlugin
3312 _velocity = newVel; 3311 _velocity = newVel;
3313 } 3312 }
3314 3313
3314
3315 private void changeangvelocity(Vector3 newAngVel)
3316 {
3317 float len = newAngVel.LengthSquared();
3318 if (len > 144.0f) // limit to 12rad/s
3319 {
3320 len = 12.0f / (float)Math.Sqrt(len);
3321 newAngVel *= len;
3322 }
3323
3324 if (!m_isSelected)
3325 {
3326 if (Body != IntPtr.Zero)
3327 {
3328 if (m_disabled)
3329 enableBodySoft();
3330 else if (!d.BodyIsEnabled(Body))
3331 d.BodyEnable(Body);
3332
3333
3334 d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z);
3335 }
3336 //resetCollisionAccounting();
3337 }
3338 m_rotationalVelocity = newAngVel;
3339 }
3340
3315 private void changeVolumedetetion(bool newVolDtc) 3341 private void changeVolumedetetion(bool newVolDtc)
3316 { 3342 {
3317 m_isVolumeDetect = newVolDtc; 3343 m_isVolumeDetect = newVolDtc;
@@ -3948,9 +3974,10 @@ namespace OpenSim.Region.Physics.OdePlugin
3948// case changes.Acceleration: 3974// case changes.Acceleration:
3949// changeacceleration((Vector3)arg); 3975// changeacceleration((Vector3)arg);
3950// break; 3976// break;
3951// case changes.AngVelocity: 3977
3952// changeangvelocity((Vector3)arg); 3978 case changes.AngVelocity:
3953// break; 3979 changeangvelocity((Vector3)arg);
3980 break;
3954 3981
3955 case changes.Force: 3982 case changes.Force:
3956 changeForce((Vector3)arg); 3983 changeForce((Vector3)arg);