mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
more work on llSetAngularVelocity()
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user