diff options
author | dahlia | 2015-02-05 23:13:06 -0800 |
---|---|---|
committer | dahlia | 2015-02-05 23:13:06 -0800 |
commit | 3b7c3378f159f31a87fe71d3ae295f2816e1be11 (patch) | |
tree | 05fadd49af25df918adaf394c1d59a3f61f24427 /OpenSim | |
parent | Set angular velocity in physics actor in SceneObjectPart.AngularVelocity sett... (diff) | |
download | opensim-SC_OLD-3b7c3378f159f31a87fe71d3ae295f2816e1be11.zip opensim-SC_OLD-3b7c3378f159f31a87fe71d3ae295f2816e1be11.tar.gz opensim-SC_OLD-3b7c3378f159f31a87fe71d3ae295f2816e1be11.tar.bz2 opensim-SC_OLD-3b7c3378f159f31a87fe71d3ae295f2816e1be11.tar.xz |
Manage Angular Velocity during llLookAt() rotation of physical objects
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6f8d07c..887c7fc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4881,8 +4881,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4881 | { | 4881 | { |
4882 | if (APIDTarget != Quaternion.Identity) | 4882 | if (APIDTarget != Quaternion.Identity) |
4883 | { | 4883 | { |
4884 | |||
4884 | if (m_APIDIterations <= 1) | 4885 | if (m_APIDIterations <= 1) |
4885 | { | 4886 | { |
4887 | AngularVelocity = Vector3.Zero; | ||
4886 | UpdateRotation(APIDTarget); | 4888 | UpdateRotation(APIDTarget); |
4887 | APIDTarget = Quaternion.Identity; | 4889 | APIDTarget = Quaternion.Identity; |
4888 | return; | 4890 | return; |
@@ -4890,7 +4892,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4890 | 4892 | ||
4891 | Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); | 4893 | Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); |
4892 | rot.Normalize(); | 4894 | rot.Normalize(); |
4893 | UpdateRotation(rot); | 4895 | |
4896 | Quaternion dR = rot / RotationOffset; | ||
4897 | Vector3 axis; | ||
4898 | float angle; | ||
4899 | dR.GetAxisAngle(out axis, out angle); | ||
4900 | axis *= RotationOffset; | ||
4901 | axis.Normalize(); | ||
4902 | axis *= angle / 11; // simulator update frequency is 10-11 Hz | ||
4903 | AngularVelocity = axis; | ||
4894 | 4904 | ||
4895 | m_APIDIterations--; | 4905 | m_APIDIterations--; |
4896 | 4906 | ||