Handle ObjectSpin* packets to spin physical prims on Ctrl+Shift+Drag

Addresses Mantis #3381

The current implementation works as expected if the object has no rotation or 
only rotation around the Z axis; you can spin the object left or right (around
the world Z axis).

It works a little unexpectedly if the object has a non-Z-axis rotation; in this
case the body is spun about its local Z axis, not the world Z-axis. (But SL 
also behaves oddly with a spin on an arbitrarily rotated object.)
This commit is contained in:
nlin
2009-04-10 06:39:52 +00:00
parent e8dfa00d8c
commit 8e6c20b27f
11 changed files with 198 additions and 3 deletions

View File

@@ -132,6 +132,14 @@ namespace OpenSim.Region.Framework.Scenes
public event SceneGroupGrabed OnSceneGroupGrab;
public delegate bool SceneGroupSpinStarted(UUID groupID);
public event SceneGroupSpinStarted OnSceneGroupSpinStart;
public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation);
public event SceneGroupSpun OnSceneGroupSpin;
public delegate void LandObjectAdded(ILandObject newParcel);
public event LandObjectAdded OnLandObjectAdded;
@@ -381,6 +389,8 @@ namespace OpenSim.Region.Framework.Scenes
private StopScript handlerStopScript = null; //OnStopScript;
private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove;
private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab;
private SceneGroupSpinStarted handlerSceneGroupSpinStarted = null; //OnSceneGroupSpinStart;
private SceneGroupSpun handlerSceneGroupSpin = null; //OnSceneGroupSpin;
private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
@@ -636,6 +646,28 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
public bool TriggerGroupSpinStart(UUID groupID)
{
handlerSceneGroupSpinStarted = OnSceneGroupSpinStart;
if (handlerSceneGroupSpinStarted != null)
{
return handlerSceneGroupSpinStarted(groupID);
}
return true;
}
public bool TriggerGroupSpin(UUID groupID, Quaternion rotation)
{
handlerSceneGroupSpin = OnSceneGroupSpin;
if (handlerSceneGroupSpin != null)
{
return handlerSceneGroupSpin(groupID, rotation);
}
return true;
}
public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
{
handlerSceneGroupGrab = OnSceneGroupGrab;