diff options
author | dahlia | 2015-02-16 23:51:37 -0800 |
---|---|---|
committer | dahlia | 2015-02-16 23:51:37 -0800 |
commit | 8b2af1071f37e45dc330524a4731581867616b21 (patch) | |
tree | c2e9fa657b1324113572bdca1126e2386d4f3a07 /OpenSim/Region | |
parent | Use a boolean flag to signal lookat is running instead of Quaternion.Identity... (diff) | |
download | opensim-SC-8b2af1071f37e45dc330524a4731581867616b21.zip opensim-SC-8b2af1071f37e45dc330524a4731581867616b21.tar.gz opensim-SC-8b2af1071f37e45dc330524a4731581867616b21.tar.bz2 opensim-SC-8b2af1071f37e45dc330524a4731581867616b21.tar.xz |
Add NaN and Infinity tests for SOP Velocity and Acceleration setters.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4a8be42..57ec1ae 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -929,14 +929,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
929 | 929 | ||
930 | set | 930 | set |
931 | { | 931 | { |
932 | m_velocity = value; | 932 | if (Util.IsNanOrInfinity(value)) |
933 | m_velocity = Vector3.Zero; | ||
934 | else | ||
935 | m_velocity = value; | ||
933 | 936 | ||
934 | PhysicsActor actor = PhysActor; | 937 | PhysicsActor actor = PhysActor; |
935 | if (actor != null) | 938 | if (actor != null) |
936 | { | 939 | { |
937 | if (actor.IsPhysical) | 940 | if (actor.IsPhysical) |
938 | { | 941 | { |
939 | actor.Velocity = value; | 942 | actor.Velocity = m_velocity; |
940 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 943 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
941 | } | 944 | } |
942 | } | 945 | } |
@@ -965,8 +968,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
965 | } | 968 | } |
966 | set | 969 | set |
967 | { | 970 | { |
968 | if (float.IsNaN(value.X) || float.IsNaN(value.Y) || float.IsNaN(value.Z) | 971 | if (Util.IsNanOrInfinity(value)) |
969 | || float.IsInfinity(value.X) || float.IsInfinity(value.Y) || float.IsInfinity(value.Z)) | ||
970 | m_angularVelocity = Vector3.Zero; | 972 | m_angularVelocity = Vector3.Zero; |
971 | else | 973 | else |
972 | m_angularVelocity = value; | 974 | m_angularVelocity = value; |
@@ -981,7 +983,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
981 | public Vector3 Acceleration | 983 | public Vector3 Acceleration |
982 | { | 984 | { |
983 | get { return m_acceleration; } | 985 | get { return m_acceleration; } |
984 | set { m_acceleration = value; } | 986 | set |
987 | { | ||
988 | if (Util.IsNanOrInfinity(value)) | ||
989 | m_acceleration = Vector3.Zero; | ||
990 | else | ||
991 | m_acceleration = value; | ||
992 | } | ||
985 | } | 993 | } |
986 | 994 | ||
987 | public string Description { get; set; } | 995 | public string Description { get; set; } |