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

@ -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) public void SetVelocity(Vector3 pVel, bool localGlobalTF)
{ {
if (ParentGroup == null || ParentGroup.IsDeleted) if (ParentGroup == null || ParentGroup.IsDeleted)
@ -1872,6 +1872,33 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.Velocity = pVel; 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> /// <summary>
/// hook to the physics scene to apply angular impulse /// 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); return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z);
} }
public void llSetAngularVelocity(LSL_Vector avel, int local) public void llSetAngularVelocity(LSL_Vector avel, int local)
{ {
m_host.AddScriptLPS(1); 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() public LSL_Vector llGetOmega()