bool Reset(RigidBodyComponent rigidBody) { if (!rigidBody.IsValid) { Log.Write(LogLevel.Warning, __SimpleTag, "Position Reset: object is no longer in the scene, removing from reset script."); return(false); } if (rigidBody.GetHeldObjectInfo().IsHeld) { // Check now that the object is still in the scene. if (null == ScenePrivate.FindObject(rigidBody.ComponentId.ObjectId)) { return(false); } if (ForceDrop) { rigidBody.ReleaseHeldObject((d) => { ResetToInitialPosition(rigidBody); }); } else { rigidBody.SubscribeToHeldObject(HeldObjectEventType.Release, (d) => { ResetToInitialPosition(rigidBody); }, false); } return(true); } else { return(ResetToInitialPosition(rigidBody)); } }
void Reset(ScriptEventData data) { if (RigidBody.GetHeldObjectInfo().IsHeld) { RigidBody.SubscribeToHeldObject(HeldObjectEventType.Release, (d) => { ResetToInitialPosition(); }, false); } else { ResetToInitialPosition(); } }