more work on llSetAngularVelocity()

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

View File

@ -1872,6 +1872,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>
/// hook to the physics scene to apply angular impulse

View File

@ -2597,12 +2597,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z);
}
public void llSetAngularVelocity(LSL_Vector avel, int local)
{
m_host.AddScriptLPS(1);
// Still not done !!!!
// m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0);
m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0);
}
public LSL_Vector llGetOmega()