more work on llSetAngularVelocity()

This commit is contained in:
UbitUmarov
2012-07-10 05:28:47 +01:00
parent ca41ec9eb4
commit 652ac5f66b
2 changed files with 29 additions and 4 deletions

View File

@@ -1845,7 +1845,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future
// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future
public void SetVelocity(Vector3 pVel, bool localGlobalTF)
{
if (ParentGroup == null || ParentGroup.IsDeleted)
@@ -1871,6 +1871,33 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.Velocity = pVel;
}
// SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future
public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF)
{
if (ParentGroup == null || ParentGroup.IsDeleted)
return;
if (ParentGroup.IsAttachment)
return; // don't work on attachments (for now ??)
SceneObjectPart root = ParentGroup.RootPart;
if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles
return;
PhysicsActor pa = root.PhysActor;
if (pa == null || !pa.IsPhysical)
return;
if (localGlobalTF)
{
pAngVel = pAngVel * GetWorldRotation();
}
root.AngularVelocity = pAngVel;
}
/// <summary>