pass touch_end as other touchs, make blockgrab work on nonphysical also
parent
7c4c3f0d10
commit
fb46eb3344
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,35 +3498,27 @@ 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);
|
||||
grabforce = grabforce * (pa.Mass * 0.1f);
|
||||
pa.AddForce(grabforce, false);
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NonPhysicalGrabMovement(pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NonPhysicalGrabMovement(pos);
|
||||
|
@ -3553,6 +3546,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="remoteClient"></param>
|
||||
public void SpinStart(IClientAPI remoteClient)
|
||||
{
|
||||
if (BlockGrabOverride || m_rootPart.BlockGrab)
|
||||
return;
|
||||
if (m_scene.EventManager.TriggerGroupSpinStart(UUID))
|
||||
{
|
||||
PhysicsActor pa = m_rootPart.PhysActor;
|
||||
|
@ -3600,13 +3595,15 @@ 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.IsPhysical)
|
||||
if (pa != null && pa.IsPhysical)
|
||||
{
|
||||
if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
|
||||
{
|
||||
|
@ -3642,11 +3639,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
NonPhysicalSpinMovement(newOrientation);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NonPhysicalSpinMovement(newOrientation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue