Maarten Baert's website

Game Maker / C++ projects

Home Model Creator ExtremePhysics Game Maker DLLs SimpleScreenRecorder AlterPCB Quadcopters   Recent comments Search

Last modified: Sun, 19 Mar 2017
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 in local coordinates (instead of world coordinates).

  • 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 (world coordinates).

  • relativey: The y coordinate relative to the center of mass (world coordinates).

  • 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 center of mass 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 center of mass 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).

Platoonsgt1

Comment #7: Mon, 7 Jan 2013, 15:26 (GMT+1, DST)

Quote


I've encountered a problem with 'ep_body_get_rot', such as used within your big_world example.
It may be intentional, but it's vale is not restrained to '0 - 2*pi', but in fact a much larger number (I haven't tested the limit, but it's breaking my comparison between the rotation of a block, and the direction of the mouse)
I will try to work around this by subtracting 2*pi from the rotation if it gets too high, and vice-versa

Edit: Fixed it, it'll only have a problem if it's spinning faster than 2*pi degrees/step, and it'll default to braking if it gives an unusually large or small value.

Last modified: Mon, 7 Jan 2013, 15:36 (GMT+1, DST)

Maarten Baert

Administrator

Comment #8: Mon, 7 Jan 2013, 17:56 (GMT+1, DST)

Quote


Quote: Platoonsgt1

It may be intentional, but it's vale is not restrained to '0 - 2*pi', but in fact a much larger number (I haven't tested the limit, but it's breaking my comparison between the rotation of a block, and the direction of the mouse)

There is no limit. This is intentional - doing otherwise would interfere with hinge joint limits.

I use this script a lot:

// round360(angle) - Returns the same angle in the [-180,180[ range.
return argument0-360*round(argument0/360);

This solves pretty much all problems when comparing angles.

Last modified: Mon, 7 Jan 2013, 17:56 (GMT+1, DST)

Platoonsgt1

Comment #9: Mon, 7 Jan 2013, 22:32 (GMT+1, DST)

Quote


Quote: Maarten Baert

There is no limit. This is intentional - doing otherwise would interfere with hinge joint limits.

I use this script a lot:

// round360(angle) - Returns the same angle in the [-180,180[ range.
return argument0-360*round(argument0/360);

This solves pretty much all problems when comparing angles.

Neat, thanks for that.

Timpossible89

Comment #10: Sat, 20 Apr 2013, 5:35 (GMT+1, DST)

Quote


Hye Maarten,

How to i rotate a physic body, let say a rectangular size 32x64, for example to be use as a watergate for your fluid example where i can open and close the gate by rotating the gate.

If i use GML, in object mouse event, left pressed, i can simply use "phy_rotation-=90" to rotate it to 90 degree. How do i achieve the same result with extremephysic?

Thanks!

Maarten Baert

Administrator

Comment #11: Sat, 20 Apr 2013, 17:28 (GMT+1, DST)

Quote


Quote: Timpossible89

Hye Maarten,

How to i rotate a physic body, let say a rectangular size 32x64, for example to be use as a watergate for your fluid example where i can open and close the gate by rotating the gate.

If i use GML, in object mouse event, left pressed, i can simply use "phy_rotation-=90" to rotate it to 90 degree. How do i achieve the same result with extremephysic?

Thanks!

You can rotate (and move) bodies with ep_body_set_position. Or the script 'physics_object_set' if you're using that. This works even for objects that are static.

Timpossible89

Comment #12: Sun, 21 Apr 2013, 1:32 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Timpossible89

Hye Maarten,

How to i rotate a physic body, let say a rectangular size 32x64, for example to be use as a watergate for your fluid example where i can open and close the gate by rotating the gate.

If i use GML, in object mouse event, left pressed, i can simply use "phy_rotation-=90" to rotate it to 90 degree. How do i achieve the same result with extremephysic?

Thanks!

You can rotate (and move) bodies with ep_body_set_position. Or the script 'physics_object_set' if you're using that. This works even for objects that are static.

Nice, Just as i wanted. Thanks Maarten.

Hye man, is this extension can be use when target to iOS? Is it just me or it really is not supported for iOS. I run on compter, its fine. But target to iOS, the object stuck at (0,0). Please help me clarify on this.

Thanks

Maarten Baert

Administrator

Comment #13: Sun, 21 Apr 2013, 16:06 (GMT+1, DST)

Quote


Quote: Timpossible89
Quote: Maarten Baert
Quote: Timpossible89

Hye Maarten,

How to i rotate a physic body, let say a rectangular size 32x64, for example to be use as a watergate for your fluid example where i can open and close the gate by rotating the gate.

If i use GML, in object mouse event, left pressed, i can simply use "phy_rotation-=90" to rotate it to 90 degree. How do i achieve the same result with extremephysic?

Thanks!

You can rotate (and move) bodies with ep_body_set_position. Or the script 'physics_object_set' if you're using that. This works even for objects that are static.

Nice, Just as i wanted. Thanks Maarten.

Hye man, is this extension can be use when target to iOS? Is it just me or it really is not supported for iOS. I run on compter, its fine. But target to iOS, the object stuck at (0,0). Please help me clarify on this.

Thanks

No, you can't. YYG doesn't provide any extension mechanism for iOS or Android. It works only on Windows (and Mac if you download that version, it's a bit outdated though).

Timpossible89

Comment #14: Sun, 21 Apr 2013, 16:35 (GMT+1, DST)

Quote


[/quote]
No, you can't. YYG doesn't provide any extension mechanism for iOS or Android. It works only on Windows (and Mac if you download that version, it's a bit outdated though).
[/quote]

I am not an expert, but other extension work fine (not physic though) on iOS. And as i notice, yours are also working fine except for your dynamic object. For static object not a problem. Only dynamic object stuck at (0,0).

Example in fluid simulation, the water are continuously being created (from water instance count) but the water stuck at (0,0). Maybe, just maybe, there is a bit of a bug with extreme physic for dynamic object that you can look at.

And as i understand YYG do provide extension mechanism for iOS. As i tested with other extensions on iOS, no problem.

So, just to let you know, if it is possible to fix anything.
By the way, this extension is awesome.

Maarten Baert

Administrator

Comment #15: Sun, 21 Apr 2013, 17:00 (GMT+1, DST)

Quote


Quote: Timpossible89

I am not an expert, but other extension work fine (not physic though) on iOS. And as i notice, yours are also working fine except for your dynamic object. For static object not a problem. Only dynamic object stuck at (0,0).

Example in fluid simulation, the water are continuously being created (from water instance count) but the water stuck at (0,0). Maybe, just maybe, there is a bit of a bug with extreme physic for dynamic object that you can look at.

And as i understand YYG do provide extension mechanism for iOS. As i tested with other extensions on iOS, no problem.

So, just to let you know, if it is possible to fix anything.
By the way, this extension is awesome.

Sorry, there is no way ExtremePhysics can run on iOS in its current form (a DLL), even if YYG had created an extension system. I haven't heard of any DLL/dylib-based extensions that run on iOS, only extensions that are based on standard GML scripts. So yes, technically there is support for extensions, but not for extensions that actually add something to Game Maker through DLLs :).

Static objects 'work' because they don't have to do anything, so yes, they will always work even when the physics engine is completely gone :P.

In order to get this to work, you would have to:

  1. Convince YYG to add a complete extension system for iOS, i.e. with support for dylib (or whatever equivalent iOS uses), and wait ...

  2. Get a Mac so you can compile ExtremePhysics for iOS (this will require some minor modifications I expect)

  3. Put that version in a new GEX for iOS.

I can't do step 2 for you, and I doubt anyone will be able to do step 1 :).

Timpossible89

Comment #16: Sun, 21 Apr 2013, 17:13 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Timpossible89

I am not an expert, but other extension work fine (not physic though) on iOS. And as i notice, yours are also working fine except for your dynamic object. For static object not a problem. Only dynamic object stuck at (0,0).

Example in fluid simulation, the water are continuously being created (from water instance count) but the water stuck at (0,0). Maybe, just maybe, there is a bit of a bug with extreme physic for dynamic object that you can look at.

And as i understand YYG do provide extension mechanism for iOS. As i tested with other extensions on iOS, no problem.

So, just to let you know, if it is possible to fix anything.
By the way, this extension is awesome.

Sorry, there is no way ExtremePhysics can run on iOS in its current form (a DLL), even if YYG had created an extension system. I haven't heard of any DLL/dylib-based extensions that run on iOS, only extensions that are based on standard GML scripts. So yes, technically there is support for extensions, but not for extensions that actually add something to Game Maker through DLLs :).

Static objects 'work' because they don't have to do anything, so yes, they will always work even when the physics engine is completely gone :P.

In order to get this to work, you would have to:

  1. Convince YYG to add a complete extension system for iOS, i.e. with support for dylib (or whatever equivalent iOS uses), and wait ...

  2. Get a Mac so you can compile ExtremePhysics for iOS (this will require some minor modifications I expect)

  3. Put that version in a new GEX for iOS.

I can't do step 2 for you, and I doubt anyone will be able to do step 1 :).

Haha, im such a noob. Now i have some clear picture of what is going on about extension on iOS. I thought it was just a bug.

Well, i have a Mac, but not very good with programming. Xcode / Cocos2D are hard, thats why bought GM Studio. Guess have to find other way around.

Well, anyways, thank you for your time Maarten!

1pietras

Comment #17: Tue, 14 May 2013, 18:35 (GMT+1, DST)

Quote


Is there a method that I could check if body collide with direct collision mask ?
It should working like a collision with virtual shape

Im making 2.5D game and collision mask is height of object.
Maybe there is another way to solve this problem ?

Maarten Baert

Administrator

Comment #18: Tue, 14 May 2013, 19:55 (GMT+1, DST)

Quote


Quote: 1pietras

Is there a method that I could check if body collide with direct collision mask ?
It should working like a collision with virtual shape

Im making 2.5D game and collision mask is height of object.
Maybe there is another way to solve this problem ?

I'm not sure what you mean. Virtual shapes can have their own collision masks and group, so you can use them to check for collisions at a specific height in your game. Is that what you need?

1pietras

Comment #19: Wed, 15 May 2013, 10:33 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: 1pietras

Is there a method that I could check if body collide with direct collision mask ?
It should working like a collision with virtual shape

Im making 2.5D game and collision mask is height of object.
Maybe there is another way to solve this problem ?

I'm not sure what you mean. Virtual shapes can have their own collision masks and group, so you can use them to check for collisions at a specific height in your game. Is that what you need?

Virtual shapes are shapes that i must create it, right ?
I have many "walls" in my game, some of them are "below" obj_player (collision mask are not matching), but i still need them to check z-coordinate landing for obj_player

And there is my question: How can i detect z_landing (collision between player_body and collision mask one level below). It is necesary to loop all obj_wall to find collision or I can get direct collision mask instantly ?

Its hard to me to explain, hope its now clear enough :)

Maarten Baert

Administrator

Comment #20: Wed, 15 May 2013, 19:10 (GMT+1, DST)

Quote


Quote: 1pietras

Virtual shapes are shapes that i must create it, right ?
I have many "walls" in my game, some of them are "below" obj_player (collision mask are not matching), but i still need them to check z-coordinate landing for obj_player

And there is my question: How can i detect z_landing (collision between player_body and collision mask one level below). It is necesary to loop all obj_wall to find collision or I can get direct collision mask instantly ?

Its hard to me to explain, hope its now clear enough :)

You don't actually have to create virtual shapes, it's all handled by ExtremePhysics. The DLL will actually create a shape, check for collisions with that shape, and then remove the shape again. The shape doesn't have a body and is not in the list of actual shapes, so this is very fast.

There are two ways to do this. The first is simple: first try it for the higher height, and if there is no collision, go one lower and try again. Repeat this. This works fine if you have only a small number of heights (e.g. a building with a first and second floor). The second method is better if you have many different heights: set the collision masks so you can detect collisions with all heights at once, and then use a for loop to check the height of every collision that is found. Pick the one with the highest height.

Ceneka

Comment #21: Tue, 25 Jun 2013, 8:20 (GMT+1, DST)

Quote


Hi there, can i ask you something?
I have two colliding objects ( the players), i need to know the velocity number in the exact moment at collision. Im using the fuction ep_body_get_xvel_center and ep_contact_get_point1_normalforce, but it keeps giving 0 or a constant, dont know why. Any tip?
Thank you alot.

Last modified: Thu, 27 Jun 2013, 4:47 (GMT+1, DST)

Maarten Baert

Administrator

Comment #22: Tue, 23 Jul 2013, 20:08 (GMT+1, DST)

Quote


Quote: Ceneka

Hi there, can i ask you something?
I have two colliding objects ( the players), i need to know the velocity number in the exact moment at collision. Im using the fuction ep_body_get_xvel_center and ep_contact_get_point1_normalforce, but it keeps giving 0 or a constant, dont know why. Any tip?
Thank you alot.

Try using ep_contact_get_point1/2_normalveldelta:

vel = max(ep_contact_get_point1_normalveldelta(global.world, c), ep_contact_get_point2_normalveldelta(global.world, c));
Earacher

Comment #23: Sun, 11 Aug 2013, 11:18 (GMT+1, DST)

Quote


hi maarten,could you teach me how to correct the errors of inertial? ,like trajectory correction(homing missile?),l'm stuck,can i set inertia to zero?

Maarten Baert

Administrator

Comment #24: Sun, 11 Aug 2013, 22:45 (GMT+1, DST)

Quote


Quote: Earacher

hi maarten,could you teach me how to correct the errors of inertial? ,like trajectory correction(homing missile?),l'm stuck,can i set inertia to zero?

The variable 'inertia' is short for 'moment of inertia' which is something like mass but for rotations. It doesn't affect speed or direction, only rotation.

You can create homing missiles by changing the velocity. Use ep_body_get_xvel_center/ep_body_get_yvel_center to get the current velocity, convert it into a direction with point_direction, now change that direction, choose a constant speed, and convert this into a vector with lengthdir_x/lengthdir_y. Then use that as the new velocity (ep_body_set_velocity_center). Something like this:

var target_direction, missile_speed, homing_speed, vx, vy, dir;
target_direction = point_direction(x, y, obj_player.x, obj_player.y);
missile_speed = 10; // pixels per step
homing_speed = 5; // degrees per step

vx = ep_body_get_xvel_center(global.world, body);
vy = ep_body_get_yvel_center(global.world, body);
dir = point_direction(0, 0, vx, vy);
dir += max(-homing_speed, min(homing_speed, round360(target_direction - dir)));
vx = lengthdir_x(missile_speed, dir);
vy = lengthdir_y(missile_speed, dir);
ep_body_set_velocity_center(global.world, body, vx, vy, 0);

The script 'round360':

// round360(angle) - Returns angle in the range [-180,180[.
return argument0-360*round(argument0/360);

If you want to rotate the missile as well, set 'norotation' to 'true' when you create the body (so ExtremePhysics won't rotate it for you), and add this line after the homing code:

ep_body_set_position(global.world, body, x, y, degtorad(dir));
Earacher

Comment #25: Wed, 14 Aug 2013, 13:11 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Earacher

hi maarten,could you teach me how to correct the errors of inertial? ,like trajectory correction(homing missile?),l'm stuck,can i set inertia to zero?

The variable 'inertia' is short for 'moment of inertia' which is something like mass but for rotations. It doesn't affect speed or direction, only rotation.

You can create homing missiles by changing the velocity. Use ep_body_get_xvel_center/ep_body_get_yvel_center to get the current velocity, convert it into a direction with point_direction, now change that direction, choose a constant speed, and convert this into a vector with lengthdir_x/lengthdir_y. Then use that as the new velocity (ep_body_set_velocity_center). Something like this:

var target_direction, missile_speed, homing_speed, vx, vy, dir;
target_direction = point_direction(x, y, obj_player.x, obj_player.y);
missile_speed = 10; // pixels per step
homing_speed = 5; // degrees per step

vx = ep_body_get_xvel_center(global.world, body);
vy = ep_body_get_yvel_center(global.world, body);
dir = point_direction(0, 0, vx, vy);
dir += max(-homing_speed, min(homing_speed, round360(target_direction - dir)));
vx = lengthdir_x(missile_speed, dir);
vy = lengthdir_y(missile_speed, dir);
ep_body_set_velocity_center(global.world, body, vx, vy, 0);

The script 'round360':

// round360(angle) - Returns angle in the range [-180,180[.
return argument0-360*round(argument0/360);

If you want to rotate the missile as well, set 'norotation' to 'true' when you create the body (so ExtremePhysics won't rotate it for you), and add this line after the homing code:

ep_body_set_position(global.world, body, x, y, degtorad(dir));

Thanks a lot!

Earacher

Comment #26: Thu, 15 Aug 2013, 9:12 (GMT+1, DST)

Quote


hi maarten,when i set body's mass it become unstable/different even

ep_body_set_mass(world,body,ep_body_calculate_mass(world,body))

did i made something wrong?

Maarten Baert

Administrator

Comment #27: Tue, 20 Aug 2013, 0:29 (GMT+1, DST)

Quote


Quote: Earacher

hi maarten,when i set body's mass it become unstable/different even

ep_body_set_mass(world,body,ep_body_calculate_mass(world,body))

did i made something wrong?

ep_body_calculate_mass doesn't return the mass, it returns 1 to indicate success or 0 for failure. It sets the mass, moment of inertia and center of mass automatically, there is no need to use ep_body_set_mass.

The simulator is probably getting unstable because you have set a mass that's far too low :).

Earacher

Comment #28: Sat, 24 Aug 2013, 7:08 (GMT+1, DST)

Quote


hi maarten,i add

ep_body_apply_impulse(w,b,0,0,xforce,0,0,1,0,1);

in a step event,i thought it is a Constant Force,but velocity growing larger and larger,eh,why?

Maarten Baert

Administrator

Comment #29: Sat, 24 Aug 2013, 16:24 (GMT+1, DST)

Quote


Quote: Earacher

hi maarten,i add

ep_body_apply_impulse(w,b,0,0,xforce,0,0,1,0,1);

in a step event,i thought it is a Constant Force,but velocity growing larger and larger,eh,why?

That's what happens when you apply a constant force - it's like gravity. You can avoid this by adding damping (ep_body_set_damping).

An Average Loser

Comment #30: Sat, 26 Oct 2013, 2:23 (GMT+1, DST)

Quote


Beginner's question:

I am making a driving game in which the player can enter and exit their vehicle. The player vehicle would be replaced by an dud object, but the real vehicle's rotation direction and speed is not reported to the dud object, spawning at a standstill and in a completely different angle. Is there any way I can correct this?

Last modified: Sat, 26 Oct 2013, 2:25 (GMT+1, DST)

Maarten Baert

Administrator

Comment #31: Sat, 26 Oct 2013, 18:12 (GMT+1, DST)

Quote


Quote: An Average Loser

Beginner's question:

I am making a driving game in which the player can enter and exit their vehicle. The player vehicle would be replaced by an dud object, but the real vehicle's rotation direction and speed is not reported to the dud object, spawning at a standstill and in a completely different angle. Is there any way I can correct this?

Sure, there are functions to get the velocity and orientation of the old body, so you can apply those to the new body so the velocity and orientation is not lost. The functions you will need are:

ep_body_get_rot
ep_body_get_xvel_center
ep_body_get_yvel_center
ep_body_get_rotvel (you didn't ask for this but I think it will be useful too)
ep_body_set_position (normally this is called by physics_object_set, it also sets the orientation)
ep_body_set_velocity_center (this sets xvel, yvel and rotvel)

Last modified: Sat, 26 Oct 2013, 18:14 (GMT+1, DST)

An Average Loser

Comment #32: Sun, 27 Oct 2013, 0:03 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: An Average Loser

Beginner's question:

I am making a driving game in which the player can enter and exit their vehicle. The player vehicle would be replaced by an dud object, but the real vehicle's rotation direction and speed is not reported to the dud object, spawning at a standstill and in a completely different angle. Is there any way I can correct this?

Sure, there are functions to get the velocity and orientation of the old body, so you can apply those to the new body so the velocity and orientation is not lost. The functions you will need are:

ep_body_get_rot
ep_body_get_xvel_center
ep_body_get_yvel_center
ep_body_get_rotvel (you didn't ask for this but I think it will be useful too)
ep_body_set_position (normally this is called by physics_object_set, it also sets the orientation)
ep_body_set_velocity_center (this sets xvel, yvel and rotvel)

I've implemented the code in the car replacement script, but it still doesn't properly orient the body. the code is below, have I done something wrong?

with instance_create(x,y,objParkedCar)
{
        car_col = other.car_col;
        hp = other.hp;
        sprite_index = other.sprite_index;
        can_enter=false
        alarm[1]=fps*1
        ep_body_get_rot(global.world,other.car)
        ep_body_get_xvel_center(global.world,other.car)
        ep_body_get_yvel_center(global.world,other.car)
        ep_body_get_rotvel(global.world,other.car)
        ep_body_set_position(global.world,other.car,other.x,other.y,other.direction)
}
instance_destroy();
}

Last modified: Sun, 27 Oct 2013, 19:26 (GMT+1, DST)

Maarten Baert

Administrator

Comment #33: Sun, 27 Oct 2013, 19:29 (GMT+1, DST)

Quote


Quote: An Average Loser

I've implemented the code in the car replacement script, but it still doesn't properly orient the body. the code is below, have I done something wrong?

You didn't read the documentation for those functions, did you? ;)

with instance_create(x,y,objParkedCar)
{
        car_col = other.car_col;
        hp = other.hp;
        sprite_index = other.sprite_index;
        can_enter=false
        alarm[1]=fps*1
        
        ep_body_set_position(global.world,car,
                ep_body_get_x(global.world,other.car),
                ep_body_get_y(global.world,other.car),
                ep_body_get_rot(global.world,other.car))
        ep_body_set_velocity_center(global.world,car,
                ep_body_get_xvel_center(global.world,other.car),
                ep_body_get_yvel_center(global.world,other.car),
                ep_body_get_rotvel_center(global.world,other.car))
}
instance_destroy();
An Average Loser

Comment #34: Tue, 29 Oct 2013, 2:58 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: An Average Loser

I've implemented the code in the car replacement script, but it still doesn't properly orient the body. the code is below, have I done something wrong?

You didn't read the documentation for those functions, did you? ;)

with instance_create(x,y,objParkedCar)
{
        car_col = other.car_col;
        hp = other.hp;
        sprite_index = other.sprite_index;
        can_enter=false
        alarm[1]=fps*1
        
        ep_body_set_position(global.world,car,
                ep_body_get_x(global.world,other.car),
                ep_body_get_y(global.world,other.car),
                ep_body_get_rot(global.world,other.car))
        ep_body_set_velocity_center(global.world,car,
                ep_body_get_xvel_center(global.world,other.car),
                ep_body_get_yvel_center(global.world,other.car),
                ep_body_get_rotvel_center(global.world,other.car))
}
instance_destroy();

Forgive me, i kinda just scanned it for anything relevant. Thank you for the assistance!

Maarten Baert

Administrator

Comment #35: Sat, 2 Nov 2013, 2:22 (GMT+1, DST)

Quote


Quote: An Average Loser

Forgive me, i kinda just scanned it for anything relevant. Thank you for the assistance!

No problem :).

R3booz

Comment #36: Wed, 13 Nov 2013, 18:47 (GMT+1, DST)

Quote


Hello

i have a problem with my top-down game, all my objects slippering around like on ice :( how can i fix that?

i use this material settings:

ep_shape_set_material(global.world_1, body, shape, 0, 0.9, 0, 0);

thank you

Maarten Baert

Administrator

Comment #37: Thu, 14 Nov 2013, 12:43 (GMT+1, DST)

Quote


Quote: R3booz

Hello

i have a problem with my top-down game, all my objects slippering around like on ice :( how can i fix that?

i use this material settings:

ep_shape_set_material(global.world_1, body, shape, 0, 0.9, 0, 0);

thank you

What you're looking for is called damping (ep_body_set_damping). The material settings only affect the friction between two objects.

R3booz

Comment #38: Fri, 15 Nov 2013, 23:58 (GMT+1, DST)

Quote


thank you it works your engine is awesome :D

Oberon

Comment #39: Mon, 2 May 2016, 12:54 (GMT+1, DST)

Quote


Hello , Mr.Baert. Thanks for your great extension. I just wonder if I can convert a dynamic body into a static body?

Lukayson

Comment #40: Wed, 21 Sep 2016, 4:12 (GMT+1, DST)

Quote


Hello, is there bigger fallout on performance, when bodies are bigger? Something like 100px*5px vs 500000px*5px ? Please, and thank you

Maarten Baert

Administrator

Comment #41: Wed, 21 Sep 2016, 21:47 (GMT+1, DST)

Quote


Quote: Lukayson

Hello, is there bigger fallout on performance, when bodies are bigger? Something like 100px*5px vs 500000px*5px ? Please, and thank you

For performance it doesn't matter, except for some special rare cases related to collision checking. But you may run into numerical problems if you use huge number like that. It's generally a bad idea to make objects with extreme aspect ratios. Why are you trying to do this?

Lukayson

Comment #42: Thu, 22 Sep 2016, 0:12 (GMT+1, DST)

Quote


I am making space game with solar system (without pluto) only 3 times smaller than in real life, where 1 meter is 34 pixels. Sun is x=0 y=0. I tested EP and all its functions that I normally use, and even at pluto coordinates, it worked pretty well, same as in centre. When player want to land, bodies of rocket are teleported to one of huge boxes, where land uctually is, because planets move and rotate, and i need calm surface. I was also amazed how calm EP is, in huge speeds, i can normaly move my character in rocket , same as on ground, only now with zero gravity.

Last modified: Thu, 22 Sep 2016, 0:15 (GMT+1, DST)

Maarten Baert

Administrator

Comment #43: Fri, 23 Sep 2016, 2:26 (GMT+1, DST)

Quote


Quote: Lukayson

I am making space game with solar system (without pluto) only 3 times smaller than in real life, where 1 meter is 34 pixels. Sun is x=0 y=0. I tested EP and all its functions that I normally use, and even at pluto coordinates, it worked pretty well, same as in centre. When player want to land, bodies of rocket are teleported to one of huge boxes, where land uctually is, because planets move and rotate, and i need calm surface. I was also amazed how calm EP is, in huge speeds, i can normaly move my character in rocket , same as on ground, only now with zero gravity.

Haha, that's pretty amazing. I wouldn't have expected that to work that well. If you are already doing solar system scale physics, then the size of the box doesn't matter that much. The only difference is that the collision detection system may be a bit less accurate if you use very large shapes.

Lukayson

Comment #44: Fri, 30 Jun 2017, 21:23 (GMT+1, DST)

Quote


Hello, i struggle with ep_body_set_velocity_local_point , it seem to work same as ep_body_set_velocity_center. but it does not matter what I put to local point x,y its always in center 0,0. Thank you, also thank you very much for previous help

Maarten Baert

Administrator

Comment #45: Sat, 1 Jul 2017, 20:33 (GMT+1, DST)

Quote


Quote: Lukayson

Hello, i struggle with ep_body_set_velocity_local_point , it seem to work same as ep_body_set_velocity_center. but it does not matter what I put to local point x,y its always in center 0,0. Thank you, also thank you very much for previous help

What do you expect the function to do? If rotvel is zero, then ep_body_set_velocity_center and ep_body_set_velocity_local_point do the exact same thing, this is normal.

Write a comment