From 38fb28bd68ead376554feea9d7b92edc52e9a65e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 12 Sep 2016 18:19:01 +0100 Subject: avoid siting a avatar at 0,0,0 --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 +++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cb7422b..bb6e89b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3335,11 +3335,16 @@ namespace OpenSim.Region.Framework.Scenes Velocity = Vector3.Zero; m_AngularVelocity = Vector3.Zero; + m_requestedSitTargetID = 0; + part.AddSittingAvatar(this); + + ParentPart = part; + ParentID = part.LocalId; + Vector3 cameraAtOffset = part.GetCameraAtOffset(); Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); bool forceMouselook = part.GetForceMouselook(); - if (!part.IsRoot) { Orientation = part.RotationOffset * Orientation; @@ -3365,13 +3370,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendSitResponse( part.ParentGroup.UUID, offset, Orientation, true, cameraAtOffset, cameraEyeOffset, forceMouselook); - - m_requestedSitTargetID = 0; - part.AddSittingAvatar(this); - - ParentPart = part; - ParentID = part.LocalId; SendAvatarDataToAllAgents(); @@ -5560,6 +5559,13 @@ namespace OpenSim.Region.Framework.Scenes public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID) { + foreach (ScriptControllers c in scriptedcontrols.Values) + { + SceneObjectGroup sog = m_scene.GetSceneObjectGroup(c.objectID); + if(sog != null && !sog.IsDeleted && sog.RootPart.PhysActor != null) + sog.RootPart.PhysActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData; + } + IgnoredControls = ScriptControlled.CONTROL_ZERO; lock (scriptedcontrols) { @@ -5568,6 +5574,26 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendTakeControls(int.MaxValue, false, false); } + public void HandleRevokePermissions(UUID objectID, uint permissions ) + { + + // still skeleton code + if((permissions & (16 | 0x8000 )) == 0) //PERMISSION_TRIGGER_ANIMATION | PERMISSION_OVERRIDE_ANIMATIONS + return; + if(objectID == m_scene.RegionInfo.RegionID) // for all objects + { + + } + else + { + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + if(part != null) + { + + } + } + } + public void ClearControls() { IgnoredControls = ScriptControlled.CONTROL_ZERO; -- cgit v1.1 From fb46eb3344f50aecf2796e3940a66ee6e3d57915 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Sep 2016 19:23:56 +0100 Subject: pass touch_end as other touchs, make blockgrab work on nonphysical also --- OpenSim/Region/Framework/Scenes/EventManager.cs | 2 +- .../Framework/Scenes/Scene.PacketHandlers.cs | 19 ++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 96 ++++++++++------------ 3 files changed, 54 insertions(+), 63 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 8683599..6ff3049 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -1881,7 +1881,7 @@ namespace OpenSim.Region.Framework.Scenes catch (Exception e) { m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", + "[EVENT MANAGER]: Delegate for TriggerGroupMove failed - continuing. {0} {1}", e.Message, e.StackTrace); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 4d491d1..d27af09 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -340,13 +340,11 @@ namespace OpenSim.Region.Framework.Scenes obj.ObjectGrabHandler(localID, offsetPos, remoteClient); // If the touched prim handles touches, deliver it - // If not, deliver to root prim if ((part.ScriptEvents & scriptEvents.touch_start) != 0) EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); // Deliver to the root prim if the touched prim doesn't handle touches - // or if we're meant to pass on touches anyway. Don't send to root prim - // if prim touched is the root prim as we just did it + // or if we're meant to pass on touches anyway. if (((part.ScriptEvents & scriptEvents.touch_start) == 0) || (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) { @@ -381,12 +379,10 @@ namespace OpenSim.Region.Framework.Scenes surfaceArg = surfaceArgs[0]; // If the touched prim handles touches, deliver it - // If not, deliver to root prim if ((part.ScriptEvents & scriptEvents.touch) != 0) EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); // Deliver to the root prim if the touched prim doesn't handle touches - // or if we're meant to pass on touches anyway. Don't send to root prim - // if prim touched is the root prim as we just did it + // or if we're meant to pass on touches anyway. if (((part.ScriptEvents & scriptEvents.touch) == 0) || (part.PassTouches && (part.LocalId != group.RootPart.LocalId))) { @@ -400,18 +396,21 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) return; - SceneObjectGroup obj = part.ParentGroup; + SceneObjectGroup grp = part.ParentGroup; SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) surfaceArg = surfaceArgs[0]; // If the touched prim handles touches, deliver it - // If not, deliver to root prim if ((part.ScriptEvents & scriptEvents.touch_end) != 0) EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg); - else - EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); + // if not or PassTouchs, send it also to root. + if (((part.ScriptEvents & scriptEvents.touch_end) == 0) || + (part.PassTouches && (part.LocalId != grp.RootPart.LocalId))) + { + EventManager.TriggerObjectDeGrab(grp.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); + } } public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b7c5b6b..00951d6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -79,7 +79,8 @@ namespace OpenSim.Region.Framework.Scenes touch_end = 536870912, touch_start = 2097152, transaction_result = 33554432, - object_rez = 4194304 + object_rez = 4194304, + anytouch = touch | touch_end | touch_start } public struct scriptPosTarget @@ -3497,34 +3498,26 @@ namespace OpenSim.Region.Framework.Scenes { if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) { + if (BlockGrabOverride) + return; + SceneObjectPart part = GetPart(partID); if (part == null) return; + if (part.BlockGrab) + return; + PhysicsActor pa = m_rootPart.PhysActor; - if (pa != null) + if (pa != null && pa.IsPhysical) { - if (pa.IsPhysical) - { - if (!BlockGrabOverride && !part.BlockGrab) - { -/* Vector3 llmoveforce = pos - AbsolutePosition; - Vector3 grabforce = llmoveforce; - grabforce = (grabforce / 10) * pa.Mass; - */ - // empirically convert distance diference to a impulse - Vector3 grabforce = pos - AbsolutePosition; - grabforce = grabforce * (pa.Mass/ 10.0f); - pa.AddForce(grabforce, false); - m_scene.PhysicsScene.AddPhysicsActorTaint(pa); - } - } - else - { - NonPhysicalGrabMovement(pos); - } + // empirically convert distance diference to a impulse + Vector3 grabforce = pos - AbsolutePosition; + grabforce = grabforce * (pa.Mass * 0.1f); + pa.AddForce(grabforce, false); + m_scene.PhysicsScene.AddPhysicsActorTaint(pa); } else { @@ -3553,6 +3546,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void SpinStart(IClientAPI remoteClient) { + if (BlockGrabOverride || m_rootPart.BlockGrab) + return; if (m_scene.EventManager.TriggerGroupSpinStart(UUID)) { PhysicsActor pa = m_rootPart.PhysActor; @@ -3600,46 +3595,43 @@ namespace OpenSim.Region.Framework.Scenes // but it will result in over-shoot or under-shoot of the target orientation. // For the end user, this means that ctrl+shift+drag can be used for relative, // but not absolute, adjustments of orientation for physical prims. + + if (BlockGrabOverride || m_rootPart.BlockGrab) + return; + if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation)) { PhysicsActor pa = m_rootPart.PhysActor; - if (pa != null) + if (pa != null && pa.IsPhysical) { - if (pa.IsPhysical) + if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) { - if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) - { - // first time initialization of "old" orientation for calculation of delta rotations - m_rootPart.SpinOldOrientation = newOrientation; - m_rootPart.IsWaitingForFirstSpinUpdatePacket = false; - } - else - { - // save and update old orientation - Quaternion old = m_rootPart.SpinOldOrientation; - m_rootPart.SpinOldOrientation = newOrientation; - //m_log.Error("[SCENE OBJECT GROUP]: Old orientation is " + old); - //m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation); - - // compute difference between previous old rotation and new incoming rotation - Quaternion minimalRotationFromQ1ToQ2 = Quaternion.Inverse(old) * newOrientation; - - float rotationAngle; - Vector3 rotationAxis; - minimalRotationFromQ1ToQ2.GetAxisAngle(out rotationAxis, out rotationAngle); - rotationAxis.Normalize(); - - //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); - Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); - spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor - pa.AddAngularForce(spinforce,true); - m_scene.PhysicsScene.AddPhysicsActorTaint(pa); - } + // first time initialization of "old" orientation for calculation of delta rotations + m_rootPart.SpinOldOrientation = newOrientation; + m_rootPart.IsWaitingForFirstSpinUpdatePacket = false; } else { - NonPhysicalSpinMovement(newOrientation); + // save and update old orientation + Quaternion old = m_rootPart.SpinOldOrientation; + m_rootPart.SpinOldOrientation = newOrientation; + //m_log.Error("[SCENE OBJECT GROUP]: Old orientation is " + old); + //m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation); + + // compute difference between previous old rotation and new incoming rotation + Quaternion minimalRotationFromQ1ToQ2 = Quaternion.Inverse(old) * newOrientation; + + float rotationAngle; + Vector3 rotationAxis; + minimalRotationFromQ1ToQ2.GetAxisAngle(out rotationAxis, out rotationAngle); + rotationAxis.Normalize(); + + //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); + Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); + spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor + pa.AddAngularForce(spinforce,true); + m_scene.PhysicsScene.AddPhysicsActorTaint(pa); } } else -- cgit v1.1 From 1b1871120516552fd5e51e15fa95c2f881647088 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Sep 2016 19:33:49 +0100 Subject: move SpinObject funtions from Scenegraph to PacketHandlers, close to grab handles, since they are related operations (possible should be moving to graph, not clear this files roles) --- .../Framework/Scenes/Scene.PacketHandlers.cs | 58 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++-- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 40 --------------- 3 files changed, 64 insertions(+), 44 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index d27af09..b041986 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -413,6 +413,64 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Start spinning the given object + /// + /// + /// + /// + public virtual void ProcessSpinStart(UUID objectID, IClientAPI remoteClient) + { + SceneObjectGroup group = GetGroupByPrim(objectID); + if (group != null) + { + if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) + { + group.SpinStart(remoteClient); + } + } + } + + /// + /// Spin the given object + /// + /// + /// + /// + public virtual void ProcessSpinObject(UUID objectID, Quaternion rotation, IClientAPI remoteClient) + { + SceneObjectGroup group = GetGroupByPrim(objectID); + if (group != null) + { + if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) + { + group.SpinMovement(rotation, remoteClient); + } + // This is outside the above permissions condition + // so that if the object is locked the client moving the object + // get's it's position on the simulator even if it was the same as before + // This keeps the moving user's client in sync with the rest of the world. + group.SendGroupTerseUpdate(); + } + } + + public virtual void ProcessSpinObjectStop(UUID objectID, IClientAPI remoteClient) + { + SceneObjectGroup group = GetGroupByPrim(objectID); + if (group != null) + { + if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) + { +// group.SpinMovement(rotation, remoteClient); + } + // This is outside the above permissions condition + // so that if the object is locked the client moving the object + // get's it's position on the simulator even if it was the same as before + // This keeps the moving user's client in sync with the rest of the world. + group.SendGroupTerseUpdate(); + } + } + public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, UUID itemID) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0d6af77..d77b8ae 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3329,8 +3329,6 @@ namespace OpenSim.Region.Framework.Scenes client.OnObjectRequest += RequestPrim; client.OnObjectSelect += SelectPrim; client.OnObjectDeselect += DeselectPrim; - client.OnSpinStart += m_sceneGraph.SpinStart; - client.OnSpinUpdate += m_sceneGraph.SpinObject; client.OnDeRezObject += DeRezObjects; client.OnObjectName += m_sceneGraph.PrimName; @@ -3346,6 +3344,9 @@ namespace OpenSim.Region.Framework.Scenes client.OnGrabObject += ProcessObjectGrab; client.OnGrabUpdate += ProcessObjectGrabUpdate; client.OnDeGrabObject += ProcessObjectDeGrab; + client.OnSpinStart += ProcessSpinStart; + client.OnSpinUpdate += ProcessSpinObject; + client.OnSpinStop += ProcessSpinObjectStop; client.OnUndo += m_sceneGraph.HandleUndo; client.OnRedo += m_sceneGraph.HandleRedo; client.OnObjectDescription += m_sceneGraph.PrimDescription; @@ -3456,8 +3457,6 @@ namespace OpenSim.Region.Framework.Scenes client.OnObjectRequest -= RequestPrim; client.OnObjectSelect -= SelectPrim; client.OnObjectDeselect -= DeselectPrim; - client.OnSpinStart -= m_sceneGraph.SpinStart; - client.OnSpinUpdate -= m_sceneGraph.SpinObject; client.OnDeRezObject -= DeRezObjects; client.OnObjectName -= m_sceneGraph.PrimName; client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; @@ -3472,6 +3471,9 @@ namespace OpenSim.Region.Framework.Scenes client.OnGrabObject -= ProcessObjectGrab; client.OnGrabUpdate -= ProcessObjectGrabUpdate; client.OnDeGrabObject -= ProcessObjectDeGrab; + client.OnSpinStart -= ProcessSpinStart; + client.OnSpinUpdate -= ProcessSpinObject; + client.OnSpinStop -= ProcessSpinObjectStop; client.OnUndo -= m_sceneGraph.HandleUndo; client.OnRedo -= m_sceneGraph.HandleRedo; client.OnObjectDescription -= m_sceneGraph.PrimDescription; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0e5720f..4947083 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1700,46 +1700,6 @@ namespace OpenSim.Region.Framework.Scenes } } */ - /// - /// Start spinning the given object - /// - /// - /// - /// - protected internal void SpinStart(UUID objectID, IClientAPI remoteClient) - { - SceneObjectGroup group = GetGroupByPrim(objectID); - if (group != null) - { - if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) - { - group.SpinStart(remoteClient); - } - } - } - - /// - /// Spin the given object - /// - /// - /// - /// - protected internal void SpinObject(UUID objectID, Quaternion rotation, IClientAPI remoteClient) - { - SceneObjectGroup group = GetGroupByPrim(objectID); - if (group != null) - { - if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) - { - group.SpinMovement(rotation, remoteClient); - } - // This is outside the above permissions condition - // so that if the object is locked the client moving the object - // get's it's position on the simulator even if it was the same as before - // This keeps the moving user's client in sync with the rest of the world. - group.SendGroupTerseUpdate(); - } - } /// /// -- cgit v1.1 From 2338d3d2e5cdb03a67cca7c143c7651ff0f6ee15 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 16 Sep 2016 22:10:36 +0100 Subject: change spinobject math, and a few minor things --- .../Framework/Scenes/Scene.PacketHandlers.cs | 6 ++--- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 26 ---------------------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 19 ++++++++++------ 3 files changed, 14 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index b041986..a5abe76 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -456,6 +456,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessSpinObjectStop(UUID objectID, IClientAPI remoteClient) { +/* no op for now SceneObjectGroup group = GetGroupByPrim(objectID); if (group != null) { @@ -463,12 +464,9 @@ namespace OpenSim.Region.Framework.Scenes { // group.SpinMovement(rotation, remoteClient); } - // This is outside the above permissions condition - // so that if the object is locked the client moving the object - // get's it's position on the simulator even if it was the same as before - // This keeps the moving user's client in sync with the rest of the world. group.SendGroupTerseUpdate(); } +*/ } public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 4947083..77c66b6 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1674,32 +1674,6 @@ namespace OpenSim.Region.Framework.Scenes } } } -/* moved to scene ProcessObjectGrabUpdate - /// - /// Move the given object - /// - /// - /// - /// - /// - protected internal void MoveObject(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs) - { - SceneObjectGroup group = GetGroupByPrim(objectID); - if (group != null) - { - if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) - { - group.GrabMovement(objectID, offset, pos, remoteClient); - } - - // This is outside the above permissions condition - // so that if the object is locked the client moving the object - // get's it's position on the simulator even if it was the same as before - // This keeps the moving user's client in sync with the rest of the world. - group.SendGroupTerseUpdate(); - } - } -*/ /// /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 00951d6..17dfb85 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3607,7 +3607,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) { - // first time initialization of "old" orientation for calculation of delta rotations + // first time initialization of "old" orientation for calculation of delta rotations m_rootPart.SpinOldOrientation = newOrientation; m_rootPart.IsWaitingForFirstSpinUpdatePacket = false; } @@ -3620,16 +3620,21 @@ namespace OpenSim.Region.Framework.Scenes //m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation); // compute difference between previous old rotation and new incoming rotation - Quaternion minimalRotationFromQ1ToQ2 = Quaternion.Inverse(old) * newOrientation; + Quaternion minimalRotationFromQ1ToQ2 = newOrientation * Quaternion.Inverse(old); float rotationAngle; - Vector3 rotationAxis; - minimalRotationFromQ1ToQ2.GetAxisAngle(out rotationAxis, out rotationAngle); - rotationAxis.Normalize(); + Vector3 spinforce; + minimalRotationFromQ1ToQ2.GetAxisAngle(out spinforce, out rotationAngle); + if(Math.Abs(rotationAngle)< 0.001) + return; + + spinforce.Normalize(); //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); - Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); - spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor + if(rotationAngle > 0) + spinforce = spinforce * pa.Mass * 0.1f; // 0.1 is an arbitrary torque scaling factor + else + spinforce = spinforce * pa.Mass * -0.1f; // 0.1 is an arbitrary torque scaling pa.AddAngularForce(spinforce,true); m_scene.PhysicsScene.AddPhysicsActorTaint(pa); } -- cgit v1.1