public void applyImpulse(Vector3 impulse)
{
// We check if rootpart is null here because scripts don't delete if you delete the host.
// This means that unfortunately, we can pass a null physics actor to Simulate!
// Make sure we don't do that!
SceneObjectPart rootpart = m_rootPart;
if (rootpart != null)
{
if (IsAttachment)
{
IScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null)
{
avatar.PushForce(impulse);
}
}
else
{
if (rootpart.PhysActor != null)
rootpart.PhysActor.AddForce(impulse, true);
}
}
}