Maarten Baert's website

Game Maker / C++ projects

Home Model Creator ExtremePhysics Game Maker DLLs   Recent comments Search

Last modified: Mon, 15 Aug 2011
Refresh

Body


ep_body_create_static

ep_body_create_static(world_id)

Creates a new static body.

Returns the id of the new body.

  • world_id: The id of the world.


ep_body_create_dynamic

ep_body_create_dynamic(world_id, norotation)

Creates a new dynamic body.

Returns the id of the new body.

  • world_id: The id of the world.

  • norotation: Indicates whether the rotation of this body isn't affected by other bodies.


ep_body_destroy

ep_body_destroy(world_id, body_id)

Destroys the body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_exists

ep_body_exists(world_id, body_id)

Returns whether the body with the given id exists.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_first_hingejoint

ep_body_get_first_hingejoint(world_id, body_id)

Returns the id of the first hinge joint connected to this body, or 0 if there are no hinge joints connected to this body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_last_hingejoint

ep_body_get_last_hingejoint(world_id, body_id)

Returns the id of the last hinge joint connected to this body, or 0 if there are no hinge joints connected to this body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_previous_hingejoint

ep_body_get_previous_hingejoint(world_id, body_id, hingejoint_id)

Returns the id of the previous hinge joint connected to this body, or 0 if there is no previous hinge joint.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • hingejoint_id: The id of the hinge joint.


ep_body_get_next_hingejoint

ep_body_get_next_hingejoint(world_id, body_id, hingejoint_id)

Returns the id of the next hinge joint connected to this body, or 0 if there is no next hinge joint.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • hingejoint_id: The id of the hinge joint.


ep_body_get_first_distancejoint

ep_body_get_first_distancejoint(world_id, body_id)

Returns the id of the first distance joint connected to this body, or 0 if there are no distance joints connected to this body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_last_distancejoint

ep_body_get_last_distancejoint(world_id, body_id)

Returns the id of the last distance joint connected to this body, or 0 if there are no distance joints connected to this body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_previous_distancejoint

ep_body_get_previous_distancejoint(world_id, body_id, distancejoint_id)

Returns the id of the previous distance joint connected to this body, or 0 if there is no previous distance joint.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • distancejoint_id: The id of the distance joint.


ep_body_get_next_distancejoint

ep_body_get_next_distancejoint(world_id, body_id, distancejoint_id)

Returns the id of the next distance joint connected to this body, or 0 if there is no next distance joint.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • distancejoint_id: The id of the distance joint.


ep_body_get_first_railjoint

ep_body_get_first_railjoint(world_id, body_id)

Returns the id of the first rail joint connected to this body, or 0 if there are no rail joints connected to this body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_last_railjoint

ep_body_get_last_railjoint(world_id, body_id)

Returns the id of the last rail joint connected to this body, or 0 if there are no rail joints connected to this body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_previous_railjoint

ep_body_get_previous_railjoint(world_id, body_id, railjoint_id)

Returns the id of the previous rail joint connected to this body, or 0 if there is no previous rail joint.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • railjoint_id: The id of the rail joint.


ep_body_get_next_railjoint

ep_body_get_next_railjoint(world_id, body_id, railjoint_id)

Returns the id of the next rail joint connected to this body, or 0 if there is no next rail joint.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • railjoint_id: The id of the rail joint.

ep_body_get_first_sliderjoint

ep_body_get_first_sliderjoint(world_id, body_id)

Returns the id of the first slider joint connected to this body, or 0 if there are no slider joints connected to this body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_last_sliderjoint

ep_body_get_last_sliderjoint(world_id, body_id)

Returns the id of the last slider joint connected to this body, or 0 if there are no slider joints connected to this body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_previous_sliderjoint

ep_body_get_previous_sliderjoint(world_id, body_id, sliderjoint_id)

Returns the id of the previous slider joint connected to this body, or 0 if there is no previous slider joint.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • sliderjoint_id: The id of the slider joint.


ep_body_get_next_railjoint

ep_body_get_next_railjoint(world_id, body_id, railjoint_id)

Returns the id of the next slider joint connected to this body, or 0 if there is no next slider joint.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • sliderjoint_id: The id of the slider joint.


ep_body_calculate_mass

ep_body_calculate_mass(world_id, body_id)

Calculates the center of mass, mass and moment of inertia of the body based on the shapes. Call this after creating or destroying shapes.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_set_mass

ep_body_set_mass(world_id, body_id, mass)

Changes the mass of the body.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • mass: The new mass.


ep_body_set_inertia

ep_body_set_inertia(world_id, body_id, inertia)

Changes the moment of inertia of the body

  • world_id: The id of the world.

  • body_id: The id of the body.

  • inertia: The new moment of inertia.


ep_body_set_center

ep_body_set_center(world_id, body_id, localx, localy, updateinertia)

Changes the center of mass of the body.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • localx: The x coordinate of the new center of mass, in local coordinates.

  • localy: The y coordinate of the new center of mass, in local coordinates.

  • updateinertia: Indicates whether the moment of inertia should be updated (using the parallel axis theorem).


ep_body_set_position

ep_body_set_position(world_id, body_id, x, y, rot)

Changes the position of the body using the origin of the body as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • x: The x coordinate of the new position.

  • y: The y coordinate of the new position.

  • rot: The new rotation.


ep_body_set_position_center

ep_body_set_position_center(world_id, body_id, x, y, rot)

Changes the position of the body using the center of mass of the body as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • x: The x coordinate of the new position.

  • y: The y coordinate of the new position.

  • rot: The new rotation.


ep_body_set_position_local_point

ep_body_set_position_local_point(world_id, body_id, x, y, rot, localx, localy)

Changes the position of the body using a local point of the body as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • x: The x coordinate of the new position.

  • y: The y coordinate of the new position.

  • rot: The new rotation.

  • localx: The x coordinate of the reference point (local).

  • localx: The y coordinate of the reference point (local).


ep_body_set_velocity_center

ep_body_set_velocity_center(world_id, body_id, xvel, yvel, rotvel)

Changes the velocity of the body using the center of mass of the body as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • xvel: The x component of the new velocity of the body.

  • yvel: The y component of the new velocity of the body.

  • rotvel: The new rotational velocity of the body.


ep_body_set_velocity_local_point

ep_body_set_velocity_local_point(world_id, body_id, xvel, yvel, rotvel, localx, localy)

Changes the velocity of the body using a local point of the body as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • xvel: The x component of the new velocity of the body.

  • yvel: The y component of the new velocity of the body.

  • rotvel: The new rotational velocity of the body.

  • localx: The x coordinate of the reference point (local).

  • localx: The y coordinate of the reference point (local).


ep_body_set_max_velocity

ep_body_set_max_velocity(world_id, body_id, maxvel, maxrotvel)

Changes the maximum velocity of the body.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • maxvel: The new maximum velocity. Use 0 for no limit.

  • maxrotvel: The new maximum rotational velocity. Use 0 for no limit.


ep_body_set_gravity

ep_body_set_gravity(world_id, body_id, gravity_x, gravity_y)

Changes the gravity of the body, ignoring the mass.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • gravity_x: The x component of the new gravity of the body.

  • gravity_y: The y component of the new gravity of the body.


ep_body_set_damping

ep_body_set_damping(world_id, body_id, damping, rotdamping)

Changes the damping factors of the body.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • damping: The new damping factor of the body.

  • rotdamping: The new rotational damping factor of the body.


ep_body_store_impulses

ep_body_store_impulses(world_id, body_id, storecontactimpulses, storejointimpulses)

Changes whether impulses are stored for the body. Impulses are stored only when this setting is set to true for both bodies.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • storecontactimpulses: Indicates whether contact impulses are stored. The default value is true.

  • storejointimpulses: Indicates whether joint impulses are stored. The default value is true.


ep_body_set_sleeping

ep_body_set_sleeping(world_id, body_id, sleepstable, sleepoutofview)

Changes the sleeping settings of the body. These settings are ignored if sleeping when stable or sleeping out of view is disabled for the world.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • sleepstable: Indicates whether the body should sleep when it is stable. The default value is true.

  • sleepoutofview: Indicates whether the body should sleep when it is out of view. The default value is true.


ep_body_collision_test_box

ep_body_collision_test_box(world_id, body_id, w, h, x, y, rot, contact_threshold, collidemask1, collidemask2, group)

Returns the number of shapes that collide with a 'virtual' box. You can use ep_world_get_collision_shape to get the ids of the shapes.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • w: The width of the box.

  • h: The height of the box.

  • x: The x coordinate of the box (world coordinates).

  • y: The y coordinate of the box (world coordinates).

  • rot: The rotation of the box (world coordinates).

  • contact_threshold: The contact threshold.

  • collidemask1: The first collision mask.

  • collidemask2: The second collision mask.

  • group: The group. Use 0 for no group.


ep_body_collision_test_line

ep_body_collision_test_line(world_id, body_id, x1, y1, x2, y2, contact_threshold, collidemask1, collidemask2, group)

Returns the number of shapes that collide with a 'virtual' line. You can use ep_world_get_collision_shape to get the ids of the shapes.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • x1: The x coordinate of the first point (world coordinates).

  • y1: The y coordinate of the first point (world coordinates).

  • x2: The x coordinate of the second point (world coordinates).

  • y2: The y coordinate of the second point (world coordinates).

  • contact_threshold: The contact threshold.

  • collidemask1: The first collision mask.

  • collidemask2: The second collision mask.

  • group: The group. Use 0 for no group.


ep_body_collision_test_circle

ep_body_collision_test_circle(world_id, body_id, r, x, y, contact_threshold, collidemask1, collidemask2, group)

Returns the number of shapes that collide with a 'virtual' circle. You can use ep_world_get_collision_shape to get the ids of the shapes.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • r: The radius of the circle.

  • x: The x coordinate of the circle (world coordinates).

  • y: The y coordinate of the circle (world coordinates).

  • contact_threshold: The contact threshold.

  • collidemask1: The first collision mask.

  • collidemask2: The second collision mask.

  • group: The group. Use 0 for no group.


ep_body_collision_test_polygon

ep_body_collision_test_polygon(world_id, body_id, polygon_id, x, y, rot, contact_threshold, collidemask1, collidemask2, group)

Returns the number of shapes that collide with a 'virtual' polygon. You can use ep_world_get_collision_shape to get the ids of the shapes.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • polygon_id: The id of the polygon.

  • x: The x coordinate of the polygon (world coordinates).

  • y: The x coordinate of the polygon (world coordinates).

  • rot: The rotation of the polygon (world coordinates).

  • contact_threshold: The contact threshold.

  • collidemask1: The first collision mask.

  • collidemask2: The second collision mask.

  • group: The group. Use 0 for no group.


ep_body_ray_cast

ep_body_ray_cast(world_id, body_id, x, y, vx, vy, collidemask1, collidemask2, group)

Calculates whether a 'virtual' ray intersects the body. You can use ep_world_get_collision_shape to get the id of the shape.

Returns the distance to the point of intersection, or -1 if there is no intersection.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • x: The x coordinate of the starting point of the ray.

  • y: The y coordinate of the starting point of the ray.

  • vx: The x component of the direction vector of the ray.

  • vy: The y component of the direction vector of the ray.

  • collidemask1: The first collision mask.

  • collidemask2: The second collision mask.

  • group: The group. Use 0 for no group.


ep_body_apply_impulse

ep_body_apply_impulse(world_id, body_id, localx, localy, xforce, yforce, torque, local, ignoremass, awake)

Applies an impulse.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • localx: The x coordinate of the local point.

  • localy: The y coordinate of the local point.

  • xforce: The x component of the force.

  • yforce: The y component of the force.

  • torque: The torque.

  • local: Indicates whether the force is local.

  • ignoremass: Indicates whether the mass and moment of inertia of the body should be ignored.

  • awake: Indicates whether the impulse should awake the body. If you're not sure how to use this, use true.


ep_body_apply_impulse_relative

ep_body_apply_impulse_relative(world_id, body_id, relativex, relativey, xforce, yforce, torque, ignoremass, awake)

Applies an impulse to a point relative to the center of mass.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • relativex: The x coordinate relative to the center of mass.

  • relativey: The y coordinate relative to the center of mass.

  • xforce: The x component of the force.

  • yforce: The y component of the force.

  • torque: The torque.

  • ignoremass: Indicates whether the mass and moment of inertia of the body should be ignored.

  • awake: Indicates whether the impulse should awake the body. If you're not sure how to use this, use true.


ep_body_get_mass

ep_body_get_mass(world_id, body_id)

Returns the mass of the body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_inertia

ep_body_get_inertia(world_id, body_id)

Returns the moment of inertia of the body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_center_of_mass_x

ep_body_get_center_of_mass_x(world_id, body_id)

Returns the x coordinate of the center of mass of the body (local coordinates).

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_center_of_mass_y

ep_body_get_center_of_mass_y(world_id, body_id)

Returns the y coordinate of the center of mass of the body (local coordinates).

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_x

ep_body_get_x(world_id, body_id)

Returns the x coordinate of the body using the origin as reference (world coordinates).

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_y

ep_body_get_y(world_id, body_id)

Returns the y coordinate of the body using the origin as reference (world coordinates).

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_x_center

ep_body_get_x_center(world_id, body_id)

Returns the x coordinate of the body using the center of mass as reference (world coordinates).

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_y_center

ep_body_get_y_center(world_id, body_id)

Returns the x coordinate of the body using the center of mass as reference (world coordinates).

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_rot

ep_body_get_rot(world_id, body_id)

Returns the rotation of the body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_xvel_center

ep_body_get_xvel_center(world_id, body_id)

Returns the x velocity of the body using the origin as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_yvel_center

ep_body_get_yvel_center(world_id, body_id)

Returns the y velocity of the body using the origin as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_get_xvel_local_point

ep_body_get_xvel_local_point(world_id, body_id, localx, localy)

Returns the x coordinate of the body using a local point as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • localx: The x component of the local point.

  • localy: The y component of the local point.


ep_body_get_yvel_local_point

ep_body_get_yvel_local_point(world_id, body_id, localx, localy)

Returns the y coordinate of the body using a local point as reference.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • localx: The x component of the local point.

  • localy: The y component of the local point.


ep_body_get_rotvel

ep_body_get_rotvel(world_id, body_id)

Returns the rotational velocity of the body.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_is_static

ep_body_is_static(world_id, body_id)

Returns whether the body is static.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_is_norotation

ep_body_is_norotation(world_id, body_id)

Returns whether the body can't rotate.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_is_sleeping

ep_body_is_sleeping(world_id, body_id)

Returns whether the body is sleeping.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_stable_timer

ep_body_stable_timer(world_id, body_id)

Returns the time this body has been stable.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_out_of_view_timer

ep_body_out_of_view_timer(world_id, body_id)

Returns the time this body has been out of view.

  • world_id: The id of the world.

  • body_id: The id of the body.


Coordinate and vector conversions

ep_body_coord_local_to_world_x(world_id, body_id, localx, localy)
ep_body_coord_local_to_world_y(world_id, body_id, localx, localy)
ep_body_coord_world_to_local_x(world_id, body_id, worldx, worldy)
ep_body_coord_world_to_local_y(world_id, body_id, worldx, worldy)
ep_body_vect_local_to_world_x(world_id, body_id, vx, vy)
ep_body_vect_local_to_world_y(world_id, body_id, vx, vy)
ep_body_vect_world_to_local_x(world_id, body_id, vx, vy)
ep_body_vect_world_to_local_y(world_id, body_id, vx, vy)

These functions convert between local coordinates and vectors and world coordinates and vectors.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_boxchain_begin

ep_body_boxchain_begin(world_id, body_id, vertexcount)

Begins a new box chain.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • vertexcount: The number of vertices.


ep_body_boxchain_end

ep_body_boxchain_end(world_id, body_id, circular, ignorefirstlast, width_top, width_bottom, density)

Ends the box chain and creates the box shapes.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • circular: Indicates whether this is a circular box chain.

  • ignorefirstlast: Indicates whether the first and last box should be ignored. This setting is not used for circular box chains.

  • width_top: The width of the top of the box chain.

  • width_bottom: The width of the bottom of the box chain.

  • density: The density of the boxes.


ep_body_boxchain_set_vertex

ep_body_boxchain_set_vertex(world_id, body_id, index, x, y)

Sets the coordinates of the vertex with the given index.

  • world_id: The id of the world.

  • body_id: The id of the body.

  • index: The index (0 is the first index).

  • x: The x coordinate.

  • y: The x coordinate.


ep_body_boxchain_get_first

ep_body_boxchain_get_first(world_id, body_id)

Returns the id of the first shape of the box chain.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_boxchain_get_last

ep_body_boxchain_get_last(world_id, body_id)

Returns the id of the last shape of the box chain.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_previous

ep_body_previous(world_id, body_id)

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

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_next

ep_body_next(world_id, body_id)

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

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_set_uservar

ep_body_set_uservar(world_id, body_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.

  • index: The index (0-4).

  • value: The new value.


ep_body_get_uservar

ep_body_get_uservar(world_id, body_id, index)

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.

  • index: The index (0-4).


ep_body_first_shape

ep_body_first_shape(world_id, body_id)

Returns the id of the first shape connected to this body, or 0 if there are no shapes.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_last_shape

ep_body_last_shape(world_id, body_id)

Returns the id of the last shape connected to this body, or 0 if there are no shapes.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_shape_count

ep_body_shape_count(world_id, body_id)

Returns the number of shapes connected to this body, or 0 if there are no shapes. The body keeps track of the number of shapes internally so this function is very fast.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_first_force

ep_body_first_force(world_id, body_id)

Returns the id of the first force connected to this body, or 0 if there are no forces.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_last_force

ep_body_last_force(world_id, body_id)

Returns the id of the last force connected to this body, or 0 if there are no forces.

  • world_id: The id of the world.

  • body_id: The id of the body.


ep_body_force_count

ep_body_force_count(world_id, body_id)

Returns the number of forces connected to this body, or 0 if there are no forces. The body keeps track of the number of shapes internally so this function is very fast.

  • world_id: The id of the world.

  • body_id: The id of the body.


Comments

Luke

Comment #1: Wed, 1 Jun 2011, 20:05 (GMT+1, DST)

Quote


whats the differents between an impulse and velocity?

Maarten Baert

Administrator

Comment #2: Thu, 16 Jun 2011, 22:03 (GMT+1, DST)

Quote


Quote: Luke

whats the differents between an impulse and velocity?

An impulse is like a force that's applied only once. When you apply an impulse, the velocity of the body changes. You could also read the velocity yourself, modify it, and set it to the new value, but that's a lot more complicated and probably slower too.

Mgummelt

Comment #3: Sun, 3 Jul 2011, 7:48 (GMT+1, DST)

Quote


Hi Maarten - great extension! I have a question about applying rotational impulses.... I'm making a Star Control-like game (or like Asteroids) where you can turn your ship left & right or thrust forward. I can apply thrust through a force, but how do I apply rotational forces? Say I have a rotational acceleration of 10 degrees per second per second - how would I apply that to a body?

I could fake it with off-center forces or two bodies with a hinge & a motor, but it seems like I should be able to do this more simply, more directly and with a single body?

I also don't want to directly set the velocity, I'd like it to be relative to what's already happening with the body (so if you're spinning right and press the left key, you slow down your rightward spin and eventually start spinning left).

Thanks! And, again - nice work!
Mike Gummelt

Mgummelt

Comment #4: Sun, 3 Jul 2011, 8:07 (GMT+1, DST)

Quote


Actually, I think I just figured out how to do this in a roundabout way - by getting the body's rotvel, then mucking with it and using set_velocity.

Not exactly what I was trying to do (which was just apply a rotational impulse and let the engine's physics handle it), but it mostly works.

Now I'm working on applying friction to my objects. I'm finding the lack of 2D vector math functions hard to deal with - do any exist in the engine already or do I need to write my own?

Thanks again,
Mike Gummelt

Mgummelt

Comment #5: Sun, 3 Jul 2011, 8:25 (GMT+1, DST)

Quote


Okay - one last question, I swear! (for now.. heh)

With regular GM movement, I can tell an object to wrap if it goes off-screen. But it seems like the bodies don't know about that setting on their object and don't wrap (meaning the objects don't wrap as their position & rotation is reset every frame to where the body is).

Can I do this with dynamic bodies?

Thanks!
-Mike

Maarten Baert

Administrator

Comment #6: Tue, 2 Aug 2011, 2:43 (GMT+1, DST)

Quote


You can use the argument 'torque' to make the body rotate :). It's not exactly the same as rotational acceleration because it also takes the moment of inertia into account (similar to mass).

Quote: Mgummelt

Okay - one last question, I swear! (for now.. heh)

With regular GM movement, I can tell an object to wrap if it goes off-screen. But it seems like the bodies don't know about that setting on their object and don't wrap (meaning the objects don't wrap as their position & rotation is reset every frame to where the body is).

Can I do this with dynamic bodies?

Thanks!
-Mike

Yes, you can move the body with ep_body_set_position when it has to wrap. But ExtremePhysics doesn't know about the wrapping until it actually happens, so bodies won't collide with other bodies that are on the other side of the screen (not until one of the bodies wraps to the other side).

Write a comment