mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
* Added llApplyImpulse in the global frame. The object must be physical before this'll do anything. Be careful with this function as it's easy to loose prim.
This commit is contained in:
@@ -578,6 +578,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
SetPartAsRoot(newPart);
|
||||
}
|
||||
|
||||
public void applyImpulse(PhysicsVector impulse)
|
||||
{
|
||||
SceneObjectPart rootpart = m_rootPart;
|
||||
if (m_rootPart.PhysActor != null)
|
||||
{
|
||||
m_rootPart.PhysActor.AddForce(impulse);
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
|
||||
@@ -520,6 +520,21 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
protected PrimitiveBaseShape m_shape;
|
||||
|
||||
/// <summary>
|
||||
/// hook to the physics scene to apply impulse
|
||||
/// This is sent up to the group, which then finds the root prim
|
||||
/// and applies the force on the root prim of the group
|
||||
/// </summary>
|
||||
/// <param name="impulse">Vector force</param>
|
||||
public void ApplyImpulse(LLVector3 impulsei)
|
||||
{
|
||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
||||
if (m_parentGroup != null)
|
||||
{
|
||||
m_parentGroup.applyImpulse(impulse);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerScriptChangedEvent(Changed val)
|
||||
{
|
||||
if (m_parentGroup != null)
|
||||
|
||||
Reference in New Issue
Block a user