Recent comments
Showing last 30 comments, most recent first.
In ExtremePhysics / World settings:
Maarten BaertAdministrator |
Comment #1: Fri, 20 Jan 2012, 0:58 (GMT+1, DST) Quote: Rpgillespie
Also, why do you have to remove all joints between frozen bodies? Because the force needed to move the bodies would be infinite. Essentially it results in a divide by zero which would crash the game. So ExtremePhysics just doesn't allow it (you will get an error message). Quote: Rpgillespie
When you say "That means the bodies should be made static," is there a way to do this other than deleting the current body, creating a new static one with the same orientation, and then doing the reverse as soon as time is unfrozen? There's no function that will simply switch a body to static, right? Currently, no. Deleting and recreating is exactly what I did in The Machine. In one of the first versions of ExtremePhysics you could actually change the 'static-ness' of bodies, but as a result I had to do a lot of checks (things like checking whether both bodies of a joint are static). In those cases the engine would show an error message every iteration which was pretty annoying. It was also a bit of a waste of processing time because I had to do this check every iteration for every joint, even the ones that were fine. But I guess that wouldn't be an issue anymore in 2.2 because I'm already ignoring joints of sleeping bodies (in a relatively efficient way). I could allow joints between static bodies and simply ignore them. I'm not sure how changing the 'static-ness' would interfere with the sleeping system though (the sleeping system handles static bodies completely differently). It's definitely possible but not that easy. Maybe I will do it in 2.3, it's something people ask a lot. Quote: Rpgillespie
For a quick fix, I just set the mass and inertia to an extremely high value (i.e. 99999999), and it seems to work pretty darn well. Is there any downside to doing this as opposed to making it static? I suppose if the force was great enough the bodies could still be moved, but it's highly unlikely. The bodies will still move, but not very much. If it's not good enough, you can always increase the mass. I don't think there's a limit, something like 10^100 should still work. In fact you can set the mass and inertia high enough so the actual velocity becomes too low to actually change the position (because of rounding errors). The position is saved with about 16 significant digits, so if the velocity is more than about 10^16 times smaller than the position, it won't move at all. |
In ExtremePhysics / Collision filtering:
Maarten BaertAdministrator |
Comment #2: Thu, 19 Jan 2012, 23:34 (GMT+1, DST) Quote: Rpgillespie
So there are 32 possible collision masks, and each one has to be a power of 2, correct? Yes. But you can also use combinations of course, that's the point. |
In Model Creator / Documentation:
Fihril Kamal |
Comment #3: Wed, 11 Jan 2012, 0:04 (GMT+1, DST) Quote: Maarten Baert
What do you mean? There is a grid in UV mode, but by default the grid spacing is quite small (1/64). It follows the normal grid setting though, so if you set the grid size to 8, the UV grid spacing will be 8/64 = 1/8. I know it's not ideal, I plan to change this in the next version. Thanks for explaining, I understand now, I thought there's no grid at all since I can't see them in texture view mode while I'm setting grid to 1.0. Glad to hear that you planned to change this in the next version. I'm really in love with this program, I can't stop making models... :D |
In ExtremePhysics / Collision filtering:
Rpgillespie |
Comment #4: Tue, 10 Jan 2012, 5:55 (GMT+1, DST) So there are 32 possible collision masks, and each one has to be a power of 2, correct? Last modified: Tue, 10 Jan 2012, 6:33 (GMT+1, DST) |
In ExtremePhysics / World settings:
Rpgillespie |
Comment #5: Tue, 10 Jan 2012, 4:50 (GMT+1, DST) Quote: Maarten Baert
Just make sure that global.time isn't zero (or you will get divide-by-zero errors). If you want to be able to freeze time, you basically have to change the velocity to 0 and the mass to infinite. For a quick fix, I just set the mass and inertia to an extremely high value (i.e. 99999999), and it seems to work pretty darn well. Is there any downside to doing this as opposed to making it static? I suppose if the force was great enough the bodies could still be moved, but it's highly unlikely. Here's what I have: obj_controller step event: if (global.time < 1)
with (obj_time) event_user(0); //anything that inherits obj_time will be affected by time
ep_world_update_contacts(global.world);
ep_world_simulate_step(global.world);
if (global.time < 1)
with (obj_time) event_user(1);
obj_time user_event(0): ep_body_set_gravity(global.world,body,0,platformgravity*global.time*global.time);
mass = ep_body_get_mass(global.world, body);
inertia = ep_body_get_inertia(global.world, body);
xvel = ep_body_get_xvel_center(global.world, body);
yvel = ep_body_get_yvel_center(global.world, body);
rotvel = ep_body_get_rotvel(global.world,body);
if (global.time != 0)
{
if (timefrozen)
{
timefrozen = false;
load_state();
}
ep_body_set_mass(global.world, body, mass/global.time);
ep_body_set_inertia(global.world, body, inertia/global.time);
ep_body_set_velocity_center(global.world, body, xvel*global.time, yvel*global.time, rotvel*global.time);
}
else
{
if (!timefrozen)
{
timefrozen = true;
save_state();
}
ep_body_set_mass(global.world, body, 999999999);
ep_body_set_inertia(global.world, body, 999999999);
ep_body_set_velocity_center(global.world, body, 0, 0, 0);
}
obj_time user_event(1): if (global.time != 0)
{
ep_body_set_gravity(global.world,body,0,platformgravity);
mass = ep_body_get_mass(global.world, body);
inertia = ep_body_get_inertia(global.world, body);
xvel = ep_body_get_xvel_center(global.world, body);
yvel = ep_body_get_yvel_center(global.world, body);
rotvel = ep_body_get_rotvel(global.world,body);
ep_body_set_mass(global.world, body, mass*global.time);
ep_body_set_inertia(global.world, body, inertia*global.time);
ep_body_set_velocity_center(global.world, body, xvel/global.time, yvel/global.time, rotvel/global.time);
}
Last modified: Tue, 10 Jan 2012, 5:22 (GMT+1, DST) |
In ExtremePhysics / World settings:
Rpgillespie |
Comment #6: Tue, 10 Jan 2012, 4:43 (GMT+1, DST) Quote: Maarten Baert
@Rpgillespie: It's almost correct. You're right, gravity should be multiplied by global.time squared. But you should also ... ... I might have missed something, but I think this is everything. Just make sure that global.time isn't zero (or you will get divide-by-zero errors). If you want to be able to freeze time, you basically have to change the velocity to 0 and the mass to infinite. That means the bodies should be made static. You also have to remove all joints between frozen bodies temporarily. As you might have guessed this isn't exactly easy :). This is actually what I did in my game The Machine. I do want to be able to freeze time. Right now I just have it setting the velocity to 0, so they appear frozen, but they can actually still be moved if you jump on them, etc., since they are not static. When you say "That means the bodies should be made static," is there a way to do this other than deleting the current body, creating a new static one with the same orientation, and then doing the reverse as soon as time is unfrozen? There's no function that will simply switch a body to static, right? Also, why do you have to remove all joints between frozen bodies? |
In Model Creator / Documentation:
Maarten BaertAdministrator |
Comment #7: Tue, 10 Jan 2012, 2:15 (GMT+1, DST) Quote: Fihril Kamal
Hello Maarten! Thanks for making this extremely useful program, I have one question, is it possible to turn grid on while editing textures UV maps? I find it's a little difficult to place things in the right place. Thank you in advance. - M. Fihril Kamal What do you mean? There is a grid in UV mode, but by default the grid spacing is quite small (1/64). It follows the normal grid setting though, so if you set the grid size to 8, the UV grid spacing will be 8/64 = 1/8. I know it's not ideal, I plan to change this in the next version. |
In ExtremePhysics / World settings:
Maarten BaertAdministrator |
Comment #8: Tue, 10 Jan 2012, 2:08 (GMT+1, DST) @Rpgillespie: It's almost correct. You're right, gravity should be multiplied by global.time squared. But you should also ... obj_crate event_user(1):ep_body_set_gravity(global.world,body,0,platformgravity*global.time*global.time); mass = ep_body_get_mass(global.world, body); inertia = ep_body_get_inertia(global.world, body); xvel = ep_body_get_xvel_center(global.world, body); yvel = ep_body_get_yvel_center(global.world, body); rotvel = ep_body_get_rotvel(global.world,body); ep_body_set_mass(global.world, body, mass/global.time); ep_body_set_inertia(global.world, body, inertia/global.time); ep_body_set_velocity_center(global.world, body, xvel*global.time, yvel*global.time, rotvel*global.time); obj_crate event_user(0):ep_body_set_gravity(global.world,body,0,platformgravity); mass = ep_body_get_mass(global.world, body); inertia = ep_body_get_inertia(global.world, body); xvel = ep_body_get_xvel_center(global.world, body); yvel = ep_body_get_yvel_center(global.world, body); rotvel = ep_body_get_rotvel(global.world,body); ep_body_set_mass(global.world, body, mass*global.time); ep_body_set_inertia(global.world, body, inertia*global.time); ep_body_set_velocity_center(global.world, body, xvel/global.time, yvel/global.time, rotvel/global.time); I might have missed something, but I think this is everything. Just make sure that global.time isn't zero (or you will get divide-by-zero errors). If you want to be able to freeze time, you basically have to change the velocity to 0 and the mass to infinite. That means the bodies should be made static. You also have to remove all joints between frozen bodies temporarily. As you might have guessed this isn't exactly easy :). This is actually what I did in my game The Machine. Last modified: Tue, 10 Jan 2012, 2:09 (GMT+1, DST) |
In Model Creator / Documentation:
Fihril Kamal |
Comment #9: Mon, 9 Jan 2012, 19:09 (GMT+1, DST) Hello Maarten! Thanks for making this extremely useful program, I have one question, is it possible to turn grid on while editing textures UV maps? I find it's a little difficult to place things in the right place. Thank you in advance. - M. Fihril Kamal |
In ExtremePhysics / World settings:
Rpgillespie |
Comment #10: Mon, 9 Jan 2012, 1:08 (GMT+1, DST) Nevermind, I figured out how. I was on the right track with my second approach, but I figured out I needed to set gravity to the square of global.time, among a few things that I had wrong. Here's how I did it, if you are interested: controller step: ep_world_update_contacts(global.world); obj_crate event_user(1): ep_body_set_gravity(global.world,body,0,platformgravity*global.time*global.time); xvel = ep_body_get_xvel_center(global.world, body); dx = xvel - global.time*xvel; ep_body_set_velocity_center(global.world, body, xvel*global.time, yvel*global.time, rotvel*global.time); obj_crate event_user(0): ep_body_set_gravity(global.world,body,0,platformgravity); xvel = ep_body_get_xvel_center(global.world, body); ep_body_set_velocity_center(global.world, body, xvel + dx, yvel + dy, rotvel + dr); |
In ExtremePhysics / World settings:
Rpgillespie |
Comment #11: Sun, 8 Jan 2012, 9:56 (GMT+1, DST) I am trying to set up time manipulation with your physics engine, but I'm having a tough time. First, I tried putting this in the step function of the controller: This worked great, except that I couldn't selectively choose which objects I wanted to be affected by time manipulation - it was either all or none. Then I tried the more complicated approach of putting this in my step function of my controller if (global.time < 1) ep_world_update_contacts(global.world); where event_user(1) sets the velocities of each crate to global.time * [each velocity] This works alright - the results aren't quite as good as my first approach, but at least I can control which objects are affected by time manipulation. Do you have any suggestions on how I could selectively control time on objects and get results as good as my first approach? Last modified: Sun, 8 Jan 2012, 9:59 (GMT+1, DST) |
Maarten BaertAdministrator |
Comment #12: Wed, 28 Dec 2011, 21:34 (GMT+1, DST) Quote: Solarboy
Hello again! I have a question about hinge joints. How would one get the x and y of a hingejoints anchor points? Similar to how there is ep_body_get_x and ep_body_get_y for bodies, is there someway to do the equivalent for hingejoints? I haven't seen anything like this in the reference section, nor can I think of another way to obtain this information without causing other problems. Thanks for your time, and keep up the good work! Assuming you still know the local coordinates of the anchor points, you can use ep_body_coord_world_to_local_x/_y on one of the bodies. |
Solarboy |
Comment #13: Tue, 27 Dec 2011, 10:24 (GMT+1, DST) Hello again! I have a question about hinge joints. How would one get the x and y of a hingejoints anchor points? Similar to how there is ep_body_get_x and ep_body_get_y for bodies, is there someway to do the equivalent for hingejoints? I haven't seen anything like this in the reference section, nor can I think of another way to obtain this information without causing other problems. Thanks for your time, and keep up the good work! |
In Model Creator / Documentation:
Maarten BaertAdministrator |
Comment #14: Wed, 16 Nov 2011, 22:33 (GMT+1, DST) Quote: Drivinucrazy Games
Hi Maarten, Is it possible to calculate smooth vertex normals in this? I would use GMModelFix but the models it saves aren't compatible with P3DC :) Yes, click the Settings button and change the 'normal threshold' to something like 30 or 40. |
In ExtremePhysics / Tutorials:
Ninajejoe5 |
Comment #15: Wed, 16 Nov 2011, 17:15 (GMT+1, DST) I just wanted to say i have had this dll for a while now, and i have always wanted to use it but could never get a grasp on it, i could understand it but i was like whoa complicated, i i finnaly said f it might as well just put the variables together like you said, and you know it's really not all that comlicated its acctualy pretty staight forward, so thanks man keep it up, this is really gonna help me make the kinda games i want to. |
In Model Creator / Documentation:
Drivinucrazy Games |
Comment #16: Sat, 12 Nov 2011, 15:49 (GMT+1, DST) Hi Maarten, Is it possible to calculate smooth vertex normals in this? I would use GMModelFix but the models it saves aren't compatible with P3DC :) |
In ExtremePhysics / Tutorials:
Drivinucrazy Games |
Comment #17: Sun, 23 Oct 2011, 1:01 (GMT+1, DST) Quote
Disable sleeping and solve the stability problem first, and when that works you can try to enable sleeping again. Your values for stable_maxvel and stable_maxrotvel are way too high, that might actually make it worse. Sleeping generally doesn't make the simulation more stable, it just hides the problem :). Try setting baumgarte_factor to 0, and make sure the coefficient of restitution of the boxes isn't too high. Oh man, thanks. I set the sleeping values way down (10 and 1) and set baumgarte_factor to 0 and it's looking a lot more stable :D |
In ExtremePhysics / Tutorials:
Maarten BaertAdministrator |
Comment #18: Sat, 22 Oct 2011, 15:31 (GMT+1, DST) Quote: Bavogames
Is there a way to create a damage system? First read the tutorial about collision detection: Quote: Drivinucrazy Games
Hey Maarten, How do you get bodies to stop "squirming around" when piled up? I have a heap of boxes, and even with sleeping on, they don't want to stabilize. ep_world_set_settings(world,1/room_speed,20,10,0.5,0.5,0.1,0.5,1); ep_world_set_sleeping(world,1,0.1,0,200,3); Disable sleeping and solve the stability problem first, and when that works you can try to enable sleeping again. Your values for stable_maxvel and stable_maxrotvel are way too high, that might actually make it worse. Sleeping generally doesn't make the simulation more stable, it just hides the problem :). Try setting baumgarte_factor to 0, and make sure the coefficient of restitution of the boxes isn't too high. |
In ExtremePhysics / Tutorials:
Drivinucrazy Games |
Comment #19: Sat, 22 Oct 2011, 2:27 (GMT+1, DST) Hey Maarten, How do you get bodies to stop "squirming around" when piled up? I have a heap of boxes, and even with sleeping on, they don't want to stabilize. ep_world_set_settings(world,1/room_speed,20,10,0.5,0.5,0.1,0.5,1); ep_world_set_sleeping(world,1,0.1,0,200,3); Last modified: Sat, 22 Oct 2011, 2:31 (GMT+1, DST) |
In ExtremePhysics / Tutorials:
Bavogames |
Comment #20: Sat, 15 Oct 2011, 14:50 (GMT+1, DST) Is there a way to create a damage system? |
In ExtremePhysics / Tutorials:
Maarten BaertAdministrator |
Comment #21: Thu, 13 Oct 2011, 12:20 (GMT+1, DST) Quote: A_d_y
i wanna rotate my boxchain :) how can i do that :) Just rotate the body. Quote: A_d_y
Actualy how can i update boxchain points. You can't, box chains are converted to normal box shapes when you call ep_body_boxchain_end. You have to write your own code if you want to change them afterwards. |
In ExtremePhysics / Tutorials:
A_d_y |
Comment #22: Thu, 13 Oct 2011, 12:01 (GMT+1, DST) i wanna rotate my boxchain :) how can i do that :) Actualy how can i update boxchain points. |
In ExtremePhysics / Tutorials:
Solarboy |
Comment #23: Sun, 9 Oct 2011, 9:12 (GMT+1, DST) Oh man that works great, thanks! The reversed Y was what messed us up, otherwise we were much closer then I thought, literally the code was identical other then the negative sign :P Again, thank you! Your the best! |
In ExtremePhysics / Tutorials:
Gregoryogan |
Comment #24: Thu, 6 Oct 2011, 15:49 (GMT+1, DST) Hey Maarten! Hey that worked Thank you!! Hey i think a lot of GM user uses this function to move objects around and even to follow another object when placed in the Step events so thanks to you i could make a function, if you are going to release a new version of the amazing engine you could add this with the update it would be a great help for the other users, what you think? Thanks again! Function ep_body_move_towards_point(x,y,velocity) var v, vx, vy, d; |
In ExtremePhysics / Tutorials:
Maarten BaertAdministrator |
Comment #25: Thu, 6 Oct 2011, 14:07 (GMT+1, DST) @Solarboy: You can get perfect 'elastic' collisions by setting 'restitution' to 1 for both shapes. So I don't think you will actually need the angle. Anyway, it doesn't work because in GM the Y axis points down, not up. So arctan2 returns incorrect results. This should work: normal=radtodeg(arctan2(-normal_y,normal_x)) I don't know how you did the actual mirroring of the angle, but this is what I would do: new_direction = 2*normal-old_direction; If you did something else, that might also be the cause :). @Matt13: I created the functions ep_world_serialize and ep_world_unserialize exactly for situations like this. Basically you have to serialize the world right before you save the game, and destroy the world right before loading the game. When the game is loaded you should create the world again and unserialize it. I have never actually tried this with the built-in saving mechanism, though. Try this: // create event
global.world_serialize = "";
// saving:
global.world_serialize = ep_world_serialize(global.world);
game_save();
// loading:
ep_world_destroy(global.world);
game_load();
// begin step event of the object with the highest depth (the controller):
if global.world_serialize!="" {
global.world = ep_world_create();
ep_world_unserialize(global.world, global.world_serialize);
global.world_serialize = "";
}
Does this work for you? @Gregoryogan: Try this: var v, vx, vy, d;
v = 10; // this sets the (maximum) speed
vx = mouse_x-ep_body_get_x_center(global.world, body);
vy = mouse_y-ep_body_get_y_center(global.world, body);
d = sqrt(vx*vx+vy*vy);
if d>v {
vx *= v/d;
vy *= v/d;
}
ep_body_set_velocity_center(global.world, body, vx, vy, 0);
Last modified: Thu, 6 Oct 2011, 14:17 (GMT+1, DST) |
In ExtremePhysics / Tutorials:
Gregoryogan |
Comment #26: Thu, 6 Oct 2011, 6:32 (GMT+1, DST) Hello!! Hey i'm having some trubles here i'm trying to make a dynamic Body to move towards a point like move towards a point mouse_x and Mouse_y, But that doesnt work, i tried to apply impulse its works but i cant reach the specific point like mouse_x and mouse_y. Can you help please?? Greg |
In ExtremePhysics / Tutorials:
Matt13 |
Comment #27: Sun, 2 Oct 2011, 1:43 (GMT+1, DST) Hello. I am having a problem with my current game. I am using ExtremePhysics 2.2 to simulate dead bodies. Every so often, the player activates a save station and it saves the game using the gamemaker function. When the player dies it loads the game. When i load the game, i get a Extremephysics error everytime. Somthing about an object not being found. To try to solve this problem, i tried destroying the world befor loading, then after the loading block put create world. (something like this) (if player is dead) I got an error that the world was never created. How do i automatically create another world when the game is loaded???? Please help Matt |
In ExtremePhysics / Tutorials:
Solarboy |
Comment #28: Thu, 29 Sep 2011, 6:57 (GMT+1, DST) Hey Maarten, your physics engine rocks! Thank you so much for making it! I've made more progress in the months that I've been using it then the whole four years I've been working on my game. Now for a question... I'm trying to make an object, (A), bounce off another, (B), similarly to how light reflects off a mirror. So I need to calculate the normal of object (B) when (A) collides with it, thankfully you've got that covered with 'ep_contact_get_normal_x' and 'ep_contact_get_normal_y'. So I made this code to return the normal in degrees: contact=ep_shape_get_first_contact(global.world,body,shape) normal_x=ep_contact_get_normal_x(global.world, contact) normal_y=ep_contact_get_normal_y(global.world, contact) normal=radtodeg(arctan2(normal_y,normal_x)) At first I thought it worked but that was far from the truth -_- Essentially, horizontal collisions are backwards, so for instance, if (A) collides with the left of (B) it returns 0 when really it should return 180. Although diagonals and everything in between doesn't work, vertical collisions appear to work for some reason. So..um..do you have any idea what the problem is? My friends and I have been wracking our brains for days and can't seem to figure out whats going on. I personally think my math is just wrong :I I also have a question about collision filtering, I thought I understood it at first but apparently I don't :P Thanks. |
In ExtremePhysics / Collision detection:
Brunoxzx |
Comment #29: Sun, 11 Sep 2011, 10:28 (GMT+1, DST) Oh thanks, you solve the problem!. |
In ExtremePhysics / Collision detection:
Maarten BaertAdministrator |
Comment #30: Sun, 11 Sep 2011, 1:38 (GMT+1, DST) Quote: Brunoxzx
O.O you have all the reason XD. I have another question, I'm making a simple bullet, creating a new static body with 32 of speed and all goes good except that when the bullet collides with a crate the generated impulse force its huge. what can i do to reduce the impulse force of my bullet. Sorry for my bad inglish (again). Reduce the mass of the bullet. Or if you are using ep_body_calculate_mass, reduce the density of the shape(s). |