/// <summary> /// Adds and executes a physics action of type T. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="setParams">Sets the parameters of the action to be performed.</param> public void Action <T>(Action <T> setParams) where T : pe_action { var actionParams = Activator.CreateInstance <T>(); setParams(actionParams); NativeHandle.Action(actionParams); }
/// <summary> /// Adds an impulse to this <see cref="PhysicsObject"/>. /// </summary> /// <param name="impulse">Direction and length of the impulse.</param> public void AddImpulse(Vector3 impulse) { var action = new pe_action_impulse(); action.impulse = impulse; NativeHandle.Action(action); }
/// <summary> /// Set the velocity of this <see cref="PhysicsObject"/>. /// </summary> /// <param name="velocity"></param> public void SetVelocity(Vector3 velocity) { var action = new pe_action_set_velocity(); action.v = velocity; NativeHandle.Action(action); }
/// <summary> /// Adds an impulse to this <see cref="PhysicsObject"/>. The impulse will be applied to the point in world-space. /// </summary> /// <param name="impulse">Direction and length of the impulse.</param> /// <param name="point">Point of application, in world-space.</param> public void AddImpulse(Vector3 impulse, Vector3 point) { var action = new pe_action_impulse(); action.impulse = impulse; action.point = point; NativeHandle.Action(action); }
/// <summary> /// Adds an angled impulse to this <see cref="PhysicsObject"/>. /// </summary> /// <param name="impulse">Angle and length of the impulse.</param> public void AddAngImpulse(Vector3 impulse) { var action = new pe_action_impulse { angImpulse = impulse }; NativeHandle.Action(action); }
/// <summary> /// Move this <see cref="PhysicsObject"/> in a direction, but apply the velocity instantly. /// </summary> /// <param name="direction"></param> public void Jump(Vector3 direction) { var action = new pe_action_move(); //Jump mode 1 - instant velocity change action.iJump = 1; action.dir = direction; NativeHandle.Action(action); }
/// <summary> /// Move this <see cref="PhysicsObject"/> in a direction. /// </summary> /// <param name="direction"></param> public void Move(Vector3 direction) { var action = new pe_action_move(); //Jump mode 2 - just adds to current velocity action.iJump = 2; action.dir = direction; NativeHandle.Action(action); }
/// <summary> /// Adds an angled impulse to this <see cref="PhysicsObject"/>. The impulse will be applied to the point in world-space. /// </summary> /// <param name="impulse">Direction and length of the impulse.</param> /// <param name="point">Point of application in world-space.</param> public void AddAngImpulse(Vector3 impulse, Vector3 point) { var action = new pe_action_impulse { angImpulse = impulse, point = point }; NativeHandle.Action(action); }