• 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!

Problem with "physics_joint_wheel_create"

acidemic

Member
I am using the following code to attach wheels to a car:
Code:
tire_rear = instance_create (x+rear_wheel_x, y+rear_wheel_y, rear_wheel_type);
physics_joint_wheel_create(id, tire_rear, tire_rear.x, tire_rear.y, 0, 1, false, 0, 0, wheel_joint_freq_hz, wheel_joint_damping_ratio, false);

tire_front = instance_create (x+front_wheel_x, y+front_wheel_y, front_wheel_type);
physics_joint_wheel_create(id, tire_front, tire_front.x, tire_front.y, 0, 1, false, 0, 0, wheel_joint_freq_hz, wheel_joint_damping_ratio, false);
The problem is that when wheel bumps into an obstacle at higher speed it tends to move against the 'x' axis when it shouldn't do this as 'axis_x' is set to '0'.

Screenshot:
uazik2.jpg

And rear wheel at reverse speed:
Untitled-1.jpg

Can this be fixed may be by creating some additional joints which would hard fix wheels at 'x' axis?

I am working now in GMS 2, but the same issue was in GMS 1.4.
 

FrostyCat

Redemption Seeker
All joints restrict movement by applying an opposite impulse and force, there's a risk of constraints being violated like this if you apply too much at once for it to counter.

Some things to try:
  • Fully damp or overdamp the joint.
  • Reduce the car's mass.
  • Reduce the forces and/or impulses applied to the car.
  • Use a higher frame rate with frame skipping to emulate fast movement, instead of applying more forces and/or impulses.
 
M

Matt Hawkins

Guest
It might help to increase the physics update speed and physics iterations speed.
 
Top