* Added llApplyImpulse in the local frame.

0.6.0-stable
Teravus Ovares 2008-03-24 22:48:34 +00:00
parent 15a22e993d
commit dd6e6e7bdf
2 changed files with 31 additions and 13 deletions

View File

@ -560,15 +560,31 @@ namespace OpenSim.Region.Environment.Scenes
/// This is sent up to the group, which then finds the root prim /// This is sent up to the group, which then finds the root prim
/// and applies the force on the root prim of the group /// and applies the force on the root prim of the group
/// </summary> /// </summary>
/// <param name="impulse">Vector force</param> /// <param name="impulsei">Vector force</param>
public void ApplyImpulse(LLVector3 impulsei) /// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
public void ApplyImpulse(LLVector3 impulsei, bool localGlobalTF)
{ {
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
if (localGlobalTF)
{
LLQuaternion grot = GetWorldRotation();
Quaternion AXgrot = new Quaternion(grot.W,grot.X,grot.Y,grot.Z);
Vector3 AXimpulsei = new Vector3(impulsei.X, impulsei.Y, impulsei.Z);
Vector3 newimpulse = AXgrot * AXimpulsei;
impulse = new PhysicsVector(newimpulse.x, newimpulse.y, newimpulse.z);
}
else
{
if (m_parentGroup != null) if (m_parentGroup != null)
{ {
m_parentGroup.applyImpulse(impulse); m_parentGroup.applyImpulse(impulse);
} }
} }
}
public void TriggerScriptChangedEvent(Changed val) public void TriggerScriptChangedEvent(Changed val)
{ {

View File

@ -1110,12 +1110,7 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
//No energy force yet //No energy force yet
if (local == 1)
{
NotImplemented("llApplyImpulse Local Force");
}
else
{
if (force.x > 20000) if (force.x > 20000)
force.x = 20000; force.x = 20000;
if (force.y > 20000) if (force.y > 20000)
@ -1123,7 +1118,14 @@ namespace OpenSim.Region.ScriptEngine.Common
if (force.z > 20000) if (force.z > 20000)
force.z = 20000; force.z = 20000;
m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z)); if (local == 1)
{
m_host.ApplyImpulse(new LLVector3((float)force.x, (float)force.y, (float)force.z), true);
}
else
{
m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z), false);
} }
} }