I'm having fun with the vehicle always dipping forward and flipping when going over small flyoff ramps.

So, I'm attempting to reposition the VehicleWheels (along with other bits, as I read that about the CoG is at the origin (so I'm moving if forward nearer the engine), I would have thought it was based on the CollisionShape), e.g.

	#	WHEEL POSITION
	$wheel_FL.translation = Vector3(w_dist_f, w_y_f, w_pos_f)
	$wheel_FR.translation = Vector3(-w_dist_f, w_y_f, w_pos_f)
	$wheel_BL.translation = Vector3(w_dist_b, w_y_b, w_pos_b)
	$wheel_BR.translation = Vector3(-w_dist_b, w_y_b, w_pos_b)

But the wheels are always in the same place...

I can move the body mesh and CollisionShape Translation and size, also change the wheel_radius, but I don't appear to be able to change the wheel translation... Any ideas?

Cheers

Have you tried adjusting the body collision shape so that it doesn't matter even if it dips? That's the first thing that springs to mind for me.

    Lethn

    It's the centre of gravity, but good idea, just tried, but it's flipping whilst it's in mid air...

    Cheers

    Can you describe how it's flipping? Is it glitching and flipping instantly? Or is it more of a gradual thing where it's flipping on it's back or something because of physics calculations? Might be an idea to upload a video or gif so we can debug better, I suspect this is probably going to be a setup issue rather than a code issue.

      Lethn

      That was flipping when / after going over a small triangular ramp.

      I've just written a function which creates a vehicle on the fly, so I can set / test the centre of gravity, which I pushed forward to just behind the front wheels, also I've currently put the origin on the ground (at bottom of wheels)... Tests show a much improved performance when jumping and good results for not rolling in tight corners.

        totoro This is why I think a video would be a good idea, flipping in that situation I would have thought is normal, depending on where you're going on the 'triangular' ramp I would expect a car to flip simply by virtue of shape. A vehicle is rectangular, if you have a triangular ramp there's going to be issues. I'm stating the obvious but you have to remember physics calculations can get pretty realistic in engines, so if you base it on something realistic you'll have results you'd expect similar to real life. In other words, you've got to make your scene based on a realistic scenario rather than expecting it all to work if you try to do something that just wouldn't happen in real life, otherwise you're going to have to do some heavy physics tweaking to make it work.

          Lethn

          Home... here's a quick example of flipping...

          Also I tried to get stuck in the edge, but just caught instead...

          Any tips on all aspects well appreciated, cheers

            totoro Yep, that to me looks like an issue with the ramp itself, you should change the design, out of curiosity since your 'ramp' looked more like a speed bump I decided to look at some footage of people going really fast over speed bumps and guess what? They flip or they get a lot of suspension damage.

            This means you need to do some redesigning, or potentially, you need to add more mass to the vehicle itself, you do need some proper physics knowledge to design vehicle controllers and make them convincing even with the right code easily available.

            It's a lame workaround but the following stops it flipping quite well...

            var fly = ""
            #	NO WHEELS TOUCH ANYTHING
            if !$wheel_FL.is_in_contact() and !$wheel_FR.is_in_contact() and !$wheel_BL.is_in_contact() and !$wheel_BR.is_in_contact():
            	#print("FLOATING")
            	fly = "fly"
            	angular_damp = 0.9		#-1.0
            else:
            	angular_damp = -1.0

            P.S. The code tags on here are not helpful grrr

            Anyway, I was about to implement my own sort of damping / max rot before finding the angular_damp.

            Also it appears the vehicle physics does take into account the collision shape for mass, not as many state how it does work

            I think it will be mostly due to your ramp design, you've got to allow enough elevation and width for the vehicle to go up smoothly. If that worked for you great, another thing games like fornite do is they run a check on your vehicle being in mid-air and let you use WASD to rotate the vehicle until it hits the ground. I quite like this feature because it gives you so much more control and won't ruin your game due to physics nonsense.