aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde
diff options
context:
space:
mode:
authorUbitUmarov2016-11-16 13:07:23 +0000
committerUbitUmarov2016-11-16 13:07:23 +0000
commitec8393571f88ab54a47ffcb91d0f82a815a682ad (patch)
tree362b08a13538a55ef2bff7a3e4290341ce9f159c /OpenSim/Region/PhysicsModules/ubOde
parentMerge branch 'master' into httptests (diff)
parent fix parsing of a vector4 and storing on a lsl quaternion needed for lightSha... (diff)
downloadopensim-SC-ec8393571f88ab54a47ffcb91d0f82a815a682ad.zip
opensim-SC-ec8393571f88ab54a47ffcb91d0f82a815a682ad.tar.gz
opensim-SC-ec8393571f88ab54a47ffcb91d0f82a815a682ad.tar.bz2
opensim-SC-ec8393571f88ab54a47ffcb91d0f82a815a682ad.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs40
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs9
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs17
3 files changed, 52 insertions, 14 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index 9640e91..f7e1044 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -632,6 +632,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
632 } 632 }
633 } 633 }
634 634
635 public override Vector3 TargetVelocity
636 {
637 get
638 {
639 return m_targetVelocity;
640 }
641 set
642 {
643 if (value.IsFinite())
644 {
645 AddChange(changes.TargetVelocity, value);
646 }
647 else
648 {
649 m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character");
650 }
651 }
652 }
653
635 public override Vector3 Torque 654 public override Vector3 Torque
636 { 655 {
637 get { return Vector3.Zero; } 656 get { return Vector3.Zero; }
@@ -689,7 +708,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
689 } 708 }
690 else 709 else
691 { 710 {
692 AddChange(changes.Velocity, force); 711 AddChange(changes.TargetVelocity, force);
693 } 712 }
694 } 713 }
695 else 714 else
@@ -1671,16 +1690,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1671 { 1690 {
1672 AvatarGeomAndBodyDestroy(); 1691 AvatarGeomAndBodyDestroy();
1673 1692
1674
1675 float oldsz = m_size.Z; 1693 float oldsz = m_size.Z;
1676 m_size = pSize; 1694 m_size = pSize;
1677 1695
1678
1679 AvatarGeomAndBodyCreation(_position.X, _position.Y, 1696 AvatarGeomAndBodyCreation(_position.X, _position.Y,
1680 _position.Z + (m_size.Z - oldsz) * 0.5f); 1697 _position.Z + (m_size.Z - oldsz) * 0.5f);
1681 1698
1682 Velocity = Vector3.Zero; 1699// Velocity = Vector3.Zero;
1683 1700 m_targetVelocity = Vector3.Zero;
1684 1701
1685 _parent_scene.actor_name_map[collider] = (PhysicsActor)this; 1702 _parent_scene.actor_name_map[collider] = (PhysicsActor)this;
1686 _parent_scene.actor_name_map[capsule] = (PhysicsActor)this; 1703 _parent_scene.actor_name_map[capsule] = (PhysicsActor)this;
@@ -1739,6 +1756,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1739 1756
1740 private void changeVelocity(Vector3 newVel) 1757 private void changeVelocity(Vector3 newVel)
1741 { 1758 {
1759 _velocity = newVel;
1760 setFreeMove();
1761
1762 if (Body != IntPtr.Zero)
1763 d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
1764 }
1765
1766 private void changeTargetVelocity(Vector3 newVel)
1767 {
1742 m_pidControllerActive = true; 1768 m_pidControllerActive = true;
1743 m_freemove = false; 1769 m_freemove = false;
1744 _target_velocity = newVel; 1770 _target_velocity = newVel;
@@ -1881,6 +1907,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1881 changeVelocity((Vector3)arg); 1907 changeVelocity((Vector3)arg);
1882 break; 1908 break;
1883 1909
1910 case changes.TargetVelocity:
1911 changeTargetVelocity((Vector3)arg);
1912 break;
1913
1884 // case changes.Acceleration: 1914 // case changes.Acceleration:
1885 // changeacceleration((Vector3)arg); 1915 // changeacceleration((Vector3)arg);
1886 // break; 1916 // break;
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 4adf87e..60b24ec 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -1157,6 +1157,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1157 1157
1158 m_building = true; // control must set this to false when done 1158 m_building = true; // control must set this to false when done
1159 1159
1160 AddChange(changes.Add, null);
1161
1160 // get basic mass parameters 1162 // get basic mass parameters
1161 ODEPhysRepData repData = _parent_scene.m_meshWorker.NewActorPhysRep(this, _pbs, _size, m_shapetype); 1163 ODEPhysRepData repData = _parent_scene.m_meshWorker.NewActorPhysRep(this, _pbs, _size, m_shapetype);
1162 1164
@@ -1165,8 +1167,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1165 m_OBBOffset = repData.OBBOffset; 1167 m_OBBOffset = repData.OBBOffset;
1166 1168
1167 UpdatePrimBodyData(); 1169 UpdatePrimBodyData();
1168
1169 AddChange(changes.Add, null);
1170 } 1170 }
1171 1171
1172 private void resetCollisionAccounting() 1172 private void resetCollisionAccounting()
@@ -3805,6 +3805,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3805 changevelocity((Vector3)arg); 3805 changevelocity((Vector3)arg);
3806 break; 3806 break;
3807 3807
3808 case changes.TargetVelocity:
3809 break;
3810
3808// case changes.Acceleration: 3811// case changes.Acceleration:
3809// changeacceleration((Vector3)arg); 3812// changeacceleration((Vector3)arg);
3810// break; 3813// break;
@@ -3933,8 +3936,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3933 donullchange(); 3936 donullchange();
3934 break; 3937 break;
3935 3938
3936
3937
3938 default: 3939 default:
3939 donullchange(); 3940 donullchange();
3940 break; 3941 break;
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index e6aa7ef..f642699 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -112,6 +112,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
112 OriOffset, // not in use 112 OriOffset, // not in use
113 // arg Vector3 new position in local coords. Changes prim position in object 113 // arg Vector3 new position in local coords. Changes prim position in object
114 Velocity, 114 Velocity,
115 TargetVelocity,
115 AngVelocity, 116 AngVelocity,
116 Acceleration, 117 Acceleration,
117 Force, 118 Force,
@@ -1220,8 +1221,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1220 /// <param name="obj"></param> 1221 /// <param name="obj"></param>
1221 public void RemoveCollisionEventReporting(PhysicsActor obj) 1222 public void RemoveCollisionEventReporting(PhysicsActor obj)
1222 { 1223 {
1223 if (_collisionEventPrim.Contains(obj) && !_collisionEventPrimRemove.Contains(obj)) 1224 lock(_collisionEventPrimRemove)
1224 _collisionEventPrimRemove.Add(obj); 1225 {
1226 if (_collisionEventPrim.Contains(obj) && !_collisionEventPrimRemove.Contains(obj))
1227 _collisionEventPrimRemove.Add(obj);
1228 }
1225 } 1229 }
1226 1230
1227 public override float TimeDilation 1231 public override float TimeDilation
@@ -1758,10 +1762,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1758 prm.SleeperAddCollisionEvents(); 1762 prm.SleeperAddCollisionEvents();
1759 sleepers.Clear(); 1763 sleepers.Clear();
1760 1764
1761 foreach (PhysicsActor obj in _collisionEventPrimRemove) 1765 lock(_collisionEventPrimRemove)
1762 _collisionEventPrim.Remove(obj); 1766 {
1767 foreach (PhysicsActor obj in _collisionEventPrimRemove)
1768 _collisionEventPrim.Remove(obj);
1763 1769
1764 _collisionEventPrimRemove.Clear(); 1770 _collisionEventPrimRemove.Clear();
1771 }
1765 1772
1766 // do a ode simulation step 1773 // do a ode simulation step
1767 d.WorldQuickStep(world, ODE_STEPSIZE); 1774 d.WorldQuickStep(world, ODE_STEPSIZE);