From 2a3bdde0fa78c5a59c530e6d974dfd6709aa1519 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 23 Apr 2008 15:32:19 +0000 Subject: * Adds llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z,TF) * Currently if you apply that to only one or two axis you get unpredictable and sometimes explosive results. * Three axis works well enough to play with it anyway. More work is needed here. * Fixed an incorrectly named method in ODE.NET --- .../Region/Environment/Scenes/SceneObjectGroup.cs | 42 ++++++++++++++++++++-- .../Region/Environment/Scenes/SceneObjectPart.cs | 17 +++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 6af7662..4f65cc7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1179,9 +1179,12 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart rootpart = m_rootPart; if (rootpart != null) { - rootpart.PhysActor.PIDTarget = new PhysicsVector(target.X, target.Y, target.Z); - rootpart.PhysActor.PIDTau = tau; - rootpart.PhysActor.PIDActive = true; + if (rootpart.PhysActor != null) + { + rootpart.PhysActor.PIDTarget = new PhysicsVector(target.X, target.Y, target.Z); + rootpart.PhysActor.PIDTau = tau; + rootpart.PhysActor.PIDActive = true; + } } } @@ -2229,5 +2232,38 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + + internal void SetAxisRotation(int axis, int rotate10) + { + bool setX = false; + bool setY = false; + bool setZ = false; + + int xaxis = 2; + int yaxis = 4; + int zaxis = 8; + + if (m_rootPart != null) + { + setX = ((axis & xaxis) != 0) ? true : false; + setY = ((axis & yaxis) != 0) ? true : false; + setZ = ((axis & zaxis) != 0) ? true : false; + + float setval = (rotate10 > 0) ? 1f : 0f; + + if (setX) + m_rootPart.m_rotationAxis.X = setval; + if (setY) + m_rootPart.m_rotationAxis.Y = setval; + if (setZ) + m_rootPart.m_rotationAxis.Z = setval; + + if (setX || setY || setZ) + { + m_rootPart.SetPhysicsAxisRotation(); + } + + } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 4c781c5..9277954 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -104,6 +104,7 @@ namespace OpenSim.Region.Environment.Scenes private Vector3 m_sitTargetPosition = new Vector3(0, 0, 0); private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); public LLUUID m_sitTargetAvatar = LLUUID.Zero; + [XmlIgnore] public PhysicsVector m_rotationAxis = new PhysicsVector(1f,1f,1f); #region Permissions @@ -1290,6 +1291,21 @@ namespace OpenSim.Region.Environment.Scenes PhysActor.Buoyancy = fvalue; } } + + public void SetAxisRotation(int axis, int rotate) + { + if (m_parentGroup != null) + { + m_parentGroup.SetAxisRotation(axis, rotate); + + } + } + + public void SetPhysicsAxisRotation() + { + PhysActor.LockAngularMotion(m_rotationAxis); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + } public void SetFloatOnWater(int floatYN) { @@ -1306,6 +1322,7 @@ namespace OpenSim.Region.Environment.Scenes } } + public LLVector3 GetSitTargetPositionLL() { -- cgit v1.1