ExtremePhysics: all pages

Force

Last updated 28 June 2010

ep_force_create

ep_force_create(world_id, body_id, x, y, local, ignoremass)

Creates a new force.

Returns the id of the new force.

  • world_id: The id of the world.
  • body_id: The id of the body.
  • x: The x component of the point of application of the force (local coordinates).
  • y: The y component of the point of application of the force (local coordinates).
  • local: Indicates whether the force is local (the force will rotate when the body rotates).
  • ignoremass: Indicates whether the mass of the body should be ignored (the force will be multiplied by the mass of the body).

ep_force_destroy

ep_force_destroy(world_id, body_id, force_id)

Destroys the force.

  • world_id: The id of the world.
  • body_id: The id of the body.
  • force_id: The id of the force.

ep_force_exists

ep_force_exists(world_id, body_id, force_id)

Returns whether the force with the given id exists.

  • world_id: The id of the world.
  • body_id: The id of the body.
  • force_id: The id of the force.

ep_force_set_force

ep_force_set_force(world_id, body_id, force_id, xforce, yforce, torque, awake)

Changes the force of the force.

  • world_id: The id of the world.
  • body_id: The id of the body.
  • force_id: The id of the force.
  • xforce: The x component of the force.
  • yforce: The y component of the force.
  • torque: The torque.
  • awake: Indicates whether the body should be awoken if it is sleeping.

ep_force_previous

ep_force_previous(world_id, body_id, force_id)

Returns the id of the previous force, or 0 if there is no previous force.

  • world_id: The id of the world.
  • body_id: The id of the body.
  • force_id: The id of the force.

ep_force_next

ep_force_next(world_id, body_id, force_id)

Returns the id of the next force, or 0 if there is no next force.

  • world_id: The id of the world.
  • body_id: The id of the body.
  • force_id: The id of the force.

ep_force_set_uservar

ep_force_set_uservar(world_id, body_id, force_id, index, value)

Changes the value of the user variable with the given index.

  • world_id: The id of the world.
  • body_id: The id of the body.
  • force_id: The id of the force.
  • index: The index (0-4).
  • value: The new value.

ep_force_get_uservar

ep_force_get_uservar(world_id, body_id, force_id, index)

Returns the value of the user variable with the given index.

  • world_id: The id of the world.
  • body_id: The id of the body.
  • force_id: The id of the force.
  • index: The index (0-4).