added llSetVelocity. will refuse to work on vehicles and on attachments ( this last may need fix) added also some code for llSetAngularVelocity but not working still
parent
ba91d4ba93
commit
ce7864632b
|
@ -1845,6 +1845,34 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
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)
|
||||
{
|
||||
pVel = pVel * GetWorldRotation();
|
||||
}
|
||||
|
||||
ParentGroup.Velocity = pVel;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// hook to the physics scene to apply angular impulse
|
||||
/// This is sent up to the group, which then finds the root prim
|
||||
|
|
|
@ -2538,6 +2538,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
m_host.ApplyImpulse(v, local != 0);
|
||||
}
|
||||
|
||||
|
||||
public void llApplyRotationalImpulse(LSL_Vector force, int local)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
@ -2564,6 +2565,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
llSetTorque(torque, local);
|
||||
}
|
||||
|
||||
public void llSetVelocity(LSL_Vector vel, int local)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
m_host.SetVelocity(new Vector3((float)vel.x, (float)vel.y, (float)vel.z), local != 0);
|
||||
}
|
||||
|
||||
public LSL_Vector llGetVel()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
@ -2590,10 +2597,19 @@ 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);
|
||||
}
|
||||
|
||||
public LSL_Vector llGetOmega()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return new LSL_Vector(m_host.AngularVelocity.X, m_host.AngularVelocity.Y, m_host.AngularVelocity.Z);
|
||||
Vector3 avel = m_host.AngularVelocity;
|
||||
return new LSL_Vector(avel.X, avel.Y, avel.Z);
|
||||
}
|
||||
|
||||
public LSL_Float llGetTimeOfDay()
|
||||
|
|
|
@ -328,6 +328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void llSensorRemove();
|
||||
void llSensorRepeat(string name, string id, int type, double range, double arc, double rate);
|
||||
void llSetAlpha(double alpha, int face);
|
||||
void llSetAngularVelocity(LSL_Vector angvelocity, int local);
|
||||
void llSetBuoyancy(double buoyancy);
|
||||
void llSetCameraAtOffset(LSL_Vector offset);
|
||||
void llSetCameraEyeOffset(LSL_Vector offset);
|
||||
|
@ -376,6 +377,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void llSetVehicleRotationParam(int param, LSL_Rotation rot);
|
||||
void llSetVehicleType(int type);
|
||||
void llSetVehicleVectorParam(int param, LSL_Vector vec);
|
||||
void llSetVelocity(LSL_Vector velocity, int local);
|
||||
void llShout(int channelID, string text);
|
||||
LSL_Float llSin(double f);
|
||||
void llSitTarget(LSL_Vector offset, LSL_Rotation rot);
|
||||
|
|
|
@ -1475,6 +1475,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_LSL_Functions.llSetAlpha(alpha, face);
|
||||
}
|
||||
|
||||
public void llSetAngularVelocity(LSL_Vector angvelocity, int local)
|
||||
{
|
||||
m_LSL_Functions.llSetAngularVelocity(angvelocity, local);
|
||||
}
|
||||
|
||||
public void llSetBuoyancy(double buoyancy)
|
||||
{
|
||||
m_LSL_Functions.llSetBuoyancy(buoyancy);
|
||||
|
@ -1705,6 +1710,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
m_LSL_Functions.llSetVehicleVectorParam(param, vec);
|
||||
}
|
||||
|
||||
public void llSetVelocity(LSL_Vector velocity, int local)
|
||||
{
|
||||
m_LSL_Functions.llSetVelocity(velocity, local);
|
||||
}
|
||||
|
||||
public void llShout(int channelID, string text)
|
||||
{
|
||||
m_LSL_Functions.llShout(channelID, text);
|
||||
|
|
Loading…
Reference in New Issue