diff options
author | UbitUmarov | 2016-11-07 12:45:20 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-07 12:45:20 +0000 |
commit | d0ae8bb86aa64632cf2e3d4e879d7a5f5fb96bb3 (patch) | |
tree | 9a5b936145e46a5fe4740d203a3bed4e5294fd98 /OpenSim/Region | |
parent | add a few more lsl constants for attachments (diff) | |
download | opensim-SC-d0ae8bb86aa64632cf2e3d4e879d7a5f5fb96bb3.zip opensim-SC-d0ae8bb86aa64632cf2e3d4e879d7a5f5fb96bb3.tar.gz opensim-SC-d0ae8bb86aa64632cf2e3d4e879d7a5f5fb96bb3.tar.bz2 opensim-SC-d0ae8bb86aa64632cf2e3d4e879d7a5f5fb96bb3.tar.xz |
start removing old hack of using SetMomentum to just set instant velocity, now that TargetVelocity is avaiable
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 1 |
3 files changed, 39 insertions, 7 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..3403f4b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -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..6267051 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, |