Maarten Baert's website

Game Maker / C++ projects

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

Last modified: Sun, 11 Sep 2011
Refresh

Reference

All function names are lowercase and start with "ep_".

If the return value of a function is not mentioned, the function will return 1 on success and 0 on failure. Almost all other functions will also return 0 on failure.

All angles in ExtremePhysics are in radians.

This reference lists the functions in the latest version of ExtremePhysics. If some function is missing or some arguments are different, make sure you're using the latest version.



Comments

Chance

Comment #1: Thu, 7 Oct 2010, 19:25 (GMT+1, DST)

Quote


Hi Maarten. Have you considered releasing the Reference as a downloadable document? Maybe an HTML document? Even PDF would be fine.

I find myself using it a lot, and I'm worried your site may be off-air sometimes. I would panic! haha...

Maarten Baert

Administrator

Comment #2: Sat, 16 Oct 2010, 15:07 (GMT+1, DST)

Quote


I'm trying to write a script to convert everything to a zip file. It should be finished soon.

-coco-

Comment #3: Tue, 11 Jan 2011, 21:04 (GMT+1, DST)

Quote


Hello Maarten.
I like Extremephysics, it's just genious.
Do you have a project to make a Lib for Extremephysics? (with D&D icons) (with LibBuilder)
I began one, but you should better know Extremephysics than me (mine is really rudymentary).
It think it should help many users.
-Coco-

(Sorry for my english, I just learn it at school)

Maarten Baert

Administrator

Comment #4: Thu, 13 Jan 2011, 16:58 (GMT+1, DST)

Quote


Quote: -coco-

Do you have a project to make a Lib for Extremephysics? (with D&D icons) (with LibBuilder)

Currently I don't. ExtremePhysics is rather difficult anyway, I don't think D&D icons would make it easier to use :).

Nickgerrets

Comment #5: Sun, 30 Dec 2012, 16:38 (GMT+1, DST)

Quote


Is there a way to make a very smooth terrain, i tryed boxchaining in your rolling ball example, but i need something much more smoother.

Maarten Baert

Administrator

Comment #6: Sun, 30 Dec 2012, 20:14 (GMT+1, DST)

Quote


Quote: Nickgerrets

Is there a way to make a very smooth terrain, i tryed boxchaining in your rolling ball example, but i need something much more smoother.

Use more points, i.e. more boxes :). ExtremePhysics is quite good at handling many boxes as long as they're all static. If you really thing performance will be a problem (because you have a huge world), you should split the terrain into multiple parts and only create the parts that are currently visible.

If you don't want to place all the points manually, try something like Bezier splines. I have an old example with various types of curves:
http://gm.maartenbaert.be/curve.gmk
'cardinal' is probably the easiest. NURBS is more powerful, but don't try to understand it unless you really like complex math :).

Nickgerrets

Comment #7: Sun, 30 Dec 2012, 20:40 (GMT+1, DST)

Quote


The game is suddenly very slow (fps 12/60), i dont know what i changed but at first it was pretty fast. i have got about 6 dynamic and 50 static objects, why is it so slow.

I figured it out, i accidentally putted the creation of a body in the step event. :(
I am not stupid

Last modified: Sun, 30 Dec 2012, 20:52 (GMT+1, DST)

Caohimin

Comment #8: Sat, 29 Jun 2013, 23:26 (GMT+1, DST)

Quote


Bonjour Maarten,

Je suis français, et nouvel utilisateur de "Extreme Physics". Je viens vers toi pour essayer de comprendre comment mettre en mouvement un objet ( vaisseau, dans mon cas, en vue du dessus ), je ne sais pas par où commencer... Si tu pouvais m'éclairé un peu.

Merci.

Maarten Baert

Administrator

Comment #9: Tue, 23 Jul 2013, 20:13 (GMT+1, DST)

Quote


Quote: Caohimin

Bonjour Maarten,

Je suis français, et nouvel utilisateur de "Extreme Physics". Je viens vers toi pour essayer de comprendre comment mettre en mouvement un objet ( vaisseau, dans mon cas, en vue du dessus ), je ne sais pas par où commencer... Si tu pouvais m'éclairé un peu.

Merci.

I understand your question, but I don't think I can answer this in french, sorry ;).

If you want to move the object with a specific velocity, use ep_body_set_velocity_center. If you just want to push the object, use ep_body_apply_impulse_relative. In any case, don't try to move the body directly (ep_body_set_position), otherwise ExtremePhysics can't simulate collisions correctly.

Lukayson

Comment #10: Mon, 30 Mar 2015, 17:25 (GMT+1, DST)

Quote


Good day, is there possibility how to simulate air resistance? I am making rocket simulator. I need different behavior between vacuum and air. Thank you

Maarten Baert

Administrator

Comment #11: Mon, 6 Apr 2015, 0:45 (GMT+1, DST)

Quote


Quote: Lukayson

Good day, is there possibility how to simulate air resistance? I am making rocket simulator. I need different behavior between vacuum and air. Thank you

ep_body_set_damping gives you basic (linear) air resistance. If this is not accurate enough for what you're doing, then you should simulate the air resistance yourself and apply it either with ep_body_apply_impulse_relative or with ep_force_create.

Lukayson

Comment #12: Sun, 11 Oct 2015, 1:49 (GMT+1, DST)

Quote


Is it possible to have EP 2.2 in Unreal Engine 4? Please

Maarten Baert

Administrator

Comment #13: Sun, 11 Oct 2015, 20:01 (GMT+1, DST)

Quote


Quote: Lukayson

Is it possible to have EP 2.2 in Unreal Engine 4? Please

I have no idea, I've never tried using UE4. You have the EP source code, so in theory nothing stops you from tying it together with whatever engine you want. You can get a pure C++ version of EP just by throwing out all the game maker related files from the source code.

Last modified: Sun, 11 Oct 2015, 20:01 (GMT+1, DST)

Lukayson

Comment #14: Mon, 19 Oct 2015, 16:15 (GMT+1, DST)

Quote


Is there any way to ask directly body, if he has any contacts, please?
I made this solution, but it is performance killer, if I use it to much.
https://drive.google.com/file/d/0B3lN5CN0ykMqRXNFb0pwTVJ6Vlk/view?usp=sharing

it is for this project: https://twitter.com/Cybermotiongame
Thank you

Last modified: Mon, 19 Oct 2015, 16:20 (GMT+1, DST)

Maarten Baert

Administrator

Comment #15: Thu, 22 Oct 2015, 20:51 (GMT+1, DST)

Quote


Quote: Lukayson

Is there any way to ask directly body, if he has any contacts, please?
I made this solution, but it is performance killer, if I use it to much.
https://drive.google.com/file/d/0B3lN5CN0ykMqRXNFb0pwTVJ6Vlk/view?usp=sharing

it is for this project: https://twitter.com/Cybermotiongame
Thank you

Yes, this is all explained in this article. Contacts are stored for each shape, not body.

Lukayson

Comment #16: Fri, 23 Oct 2015, 2:08 (GMT+1, DST)

Quote


Quote: Maarten Baert
Quote: Lukayson

Is there any way to ask directly body, if he has any contacts, please?
I made this solution, but it is performance killer, if I use it to much.
https://drive.google.com/file/d/0B3lN5CN0ykMqRXNFb0pwTVJ6Vlk/view?usp=sharing

it is for this project: https://twitter.com/Cybermotiongame
Thank you

Yes, this is all explained in this article. Contacts are stored for each shape, not body.

Thank you very much and sorry. I did not notice

Last modified: Sun, 19 Mar 2017, 16:27 (GMT+1, DST)

Lukayson

Comment #17: Tue, 7 Mar 2017, 14:57 (GMT+1, DST)

Quote


Hello, Is there a way to detect if body is sliding on another? I want for example metal part making sparks when sliding on concrete. Thank you

Maarten Baert

Administrator

Comment #18: Sun, 19 Mar 2017, 16:28 (GMT+1, DST)

Quote


Quote: Lukayson

Hello, Is there a way to detect if body is sliding on another? I want for example metal part making sparks when sliding on concrete. Thank you

Read this article. Combine this with ep_body_get_xvel_local_point and ep_body_get_yvel_local_point to detect whether the bodies are sliding. Example:

var s, c, b, object;
for(s = ep_body_first_shape(global.world, body); s!=0; s = ep_shape_next(global.world, body, s)) {
    for(c = ep_shape_get_first_contact(global.world, body, s); c!=0; c = ep_shape_get_next_contact(global.world, body, s, c)) {
        b = ep_contact_get_body1(global.world, c);
        if b=body {
            b = ep_contact_get_body2(global.world, c);
        }
        object = ep_body_get_user_var(global.world, b, 0);
        if object.object_index=obj_block {
            // this instance is touching a block
            
            b1 = ep_contact_get_body1(global.world, c);
            gx1 = ep_contact_get_point1_x(global.world, c);
            gy1 = ep_contact_get_point1_y(global.world, c);
            lx1 = ep_body_coord_world_to_local_x(global.world, b1, gx1, gy1);
            ly1 = ep_body_coord_world_to_local_y(global.world, b1, gx1, gy1);
            vx1 = ep_body_get_xvel_local_point(world_id, b1, lx1, ly1);
            vy1 = ep_body_get_yvel_local_point(world_id, b1, lx1, ly1);
            
            b2 = ep_contact_get_body2(global.world, c);
            gx2 = ep_contact_get_point2_x(global.world, c);
            gy2 = ep_contact_get_point2_y(global.world, c);
            lx2 = ep_body_coord_world_to_local_x(global.world, b2, gx2, gy2);
            ly2 = ep_body_coord_world_to_local_y(global.world, b2, gx2, gy2);
            vx2 = ep_body_get_xvel_local_point(world_id, b2, lx2, ly2);
            vy2 = ep_body_get_yvel_local_point(world_id, b2, lx2, ly2);
            
            nx = ep_contact_get_normal_x(global.world, c);
            ny = ep_contact_get_normal_y(global.world, c);
            vel = abs(nx * (vy1 - vy2) - ny * (vx1 - vx2));
            if(vel > 0.1) {
                // generate sparks here
            }
            
        }
    }
}

Not tested.

Last modified: Sun, 19 Mar 2017, 16:38 (GMT+1, DST)

Write a comment