• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Physics engine problems (momentum and rotation after collision)

N

NeZvers

Guest
How do I disable momentum for example pedestrian walking to waypoint overshoots and starts running around waypoint because of momentum.

And car after running into solid wall rotates like it's on super slipery ice.

What do I do with these problems.
They simply use phy_rotation and apply_physics_force.
I'd prefer to use old fashion x+=hspd & y+=vspd but that doesn't work with physics on and I can't find solution for collision with rotating objects like car (which cause crash).
 
T

TimothyAllen

Guest
If you don't want t realistic physics, why are you using the physics engine? Maybe I'm not understanding what you want.
 
P

Pyxus

Guest
How do I disable momentum for example pedestrian walking to waypoint overshoots and starts running around waypoint because of momentum.

And car after running into solid wall rotates like it's on super slipery ice.

What do I do with these problems.
They simply use phy_rotation and apply_physics_force.
I'd prefer to use old fashion x+=hspd & y+=vspd but that doesn't work with physics on and I can't find solution for collision with rotating objects like car (which cause crash).
I don't think you understand what momentum is, at least in a physics sense. There is no way to "disable" the momentum of a physics object because momentum is just a property of an object in motion; mathematically its described as the object's mass multiplied by the object's velocity. What I think your issue really is is that you're applying a force to an object to make the object accelerate in one direction, and you're wondering how to stop that object when you desire. If that's the case then the solution is to apply a counter force through some means, however what the counter force may be is solely up to you. Gamemaker's physics engine is able to emulate friction so I would just play around with those values till I got something that looked/felt right... now if you need this object to make precise pixel by pixel movements then for all of its conveniences the physics engine may not be for you. As for your rotation problem you can disable rotation by setting phy_fixed_rotation to true inside the object.
When using the physics engine you have to have a baseline understanding of classical mechanics.

Side note, the physics engine in game maker is really fun to play around with but if you want to use it effectively you need to have a baseline understanding of classical mechanics. Let me know if you need anymore help or if I failed to understand your conundrum ;)
 
N

NeZvers

Guest
@Pyxus Well I'm trying to learn by making GTA2 style game. I wanted to do it straight without physics engine, but I hit the problem with car rotation + collision (while no turning applied everything was ok, otherwise it caused while loop to freeze the game), and I created car "Physics" I preferred better than GM Physics... except wall collision. Hence I felt forced to use GM Physics.
So to have a nice collision with pedestrians I had to use physics for pedestrians which were initially made perfectly as I wanted without physics. I would like to move them the ordinary x+=hspd way, but that is disabled when physics is activated. So I'd appreciate some knowledge about moving without applying force.
I like how collision works against stuff, but a car hitting wall looks funny.
 
T

TimothyAllen

Guest
@Pyxus Well I'm trying to learn by making GTA2 style game. I wanted to do it straight without physics engine, but I hit the problem with car rotation + collision (while no turning applied everything was ok, otherwise it caused while loop to freeze the game), and I created car "Physics" I preferred better than GM Physics... except wall collision. Hence I felt forced to use GM Physics.
So to have a nice collision with pedestrians I had to use physics for pedestrians which were initially made perfectly as I wanted without physics. I would like to move them the ordinary x+=hspd way, but that is disabled when physics is activated. So I'd appreciate some knowledge about moving without applying force.
I like how collision works against stuff, but a car hitting wall looks funny.
You can set the speed (or velocity) of instances directly using the phy_speed (or phy_speed_x and phy_speed_y) variable. You can also use phy_linear_velocity_x/y variables.
 
P

Pyxus

Guest
@Pyxus Well I'm trying to learn by making GTA2 style game. I wanted to do it straight without physics engine, but I hit the problem with car rotation + collision (while no turning applied everything was ok, otherwise it caused while loop to freeze the game), and I created car "Physics" I preferred better than GM Physics... except wall collision. Hence I felt forced to use GM Physics.
So to have a nice collision with pedestrians I had to use physics for pedestrians which were initially made perfectly as I wanted without physics. I would like to move them the ordinary x+=hspd way, but that is disabled when physics is activated. So I'd appreciate some knowledge about moving without applying force.
I like how collision works against stuff, but a car hitting wall looks funny.
Alright I think I understand your situation a little bit better now, based on how you phrased your reply it seems your pedestrians are also physics objects but why? I looked up some GTA2 gameplay and if you want to replicate this I dont see any reason why the pedestrians or player character would need to be physics objects. You can have vehicles and walls checked as physics objects and have everything else be normal, then you can use functions such as place_meeting to dictate the the collisions for the non-physics objects. This way you can have the pedestrians make the pixel perfect movement you want, but also have the physics engine dictate vehicle physics. If you want to be able to run over pedestrians then you could have to check a 1 or 2 conditions [if vehicle is moving at speed greater than X and vehicle is touching pedestrian, kill_pedestrian()].

Does that help you out or did I misunderstand you?
 
N

NeZvers

Guest
@Pyxus Actually you are right, I could also do that.
Edit: actually NO since I don't have solution for car rotation collision.
 
Last edited:
Top