How did you set up the joints and rigidbodies to make them stable - ie keep the chassis from forcing the wheels through the floor and setting the stiffness and damping to keep the car from bouncing uncontrollably ?
Racing game - TrackMaster: Free-For-All Motorsport
Hi,
are you using VehicleBody? What do you use as a collision mesh? I made mine with VehicleBody and everything worked great in a basic way.
Today I tried adding a track I made in Blender (and collision shape with it) and my car isn't even to get up the hill for some reason ( https://youtu.be/tnVq8yY4H1A )
- Edited
@Unityfugee said: How did you set up the joints and rigidbodies to make them stable - ie keep the chassis from forcing the wheels through the floor and setting the stiffness and damping to keep the car from bouncing uncontrollably ?
Differently from the VehicleBody class, using only rigid bodies, the chassis won't force the wheels through the floor if it is too heavy, the chassis will only "sit" on the ground and the wheels won't be able to move. That's one of the reasons I'm not using VehicleBody class, I didn't like how the wheels went through the ground and other objects. This fact was too obvious with big wheels (the monster truck).
I'm planning on releasing the vehicle setup as open source in Github, it's just not good enough I think. While I don't do this, here are some pictures.
Some important notes:
- The 4 6DOF joints have the same setup.
- What does the trick are UPPER and LOWER DISTANCE on LINEAR LIMIT Y, and STIFFNESS and DAMPING, on LINEAR SPRING Y. Stiffness and damping are proportional to the chassis weight and can be measured in the same units, although it is not documented, I found it by trial and error. The monster truck chassis weight is 4000, so each wheel has to be able to support more or less 1/4 of the chassis weight, and the key property here is stiffness, that's the reason for a value of 1000.
- Don't forget to set CAN SLEEP on each of the wheels to FALSE.
- The wheels have a weight of 300 each.
- Angular motor on the X axis of each of the 6DOF joints gives the traction for car movement.
- Edited
@eyeEmotion said: Hi,
are you using VehicleBody? What do you use as a collision mesh? I made mine with VehicleBody and everything worked great in a basic way.
Today I tried adding a track I made in Blender (and collision shape with it) and my car isn't even to get up the hill for some reason
I'm using a custom solution of only rigid bodies and 6DOF joints, see my answers to @Unityfugee above. I think that for a regular car, or race car, the vehicle body is good. But for big wheels or off-road vehicles, there are too many limitations (when I started my prototypes, in 3.1 there was no per wheel steering nor traction, but even now, it's not what I'm looking for).
About the collision mesh, I'm using the default Godot shapes: cyllinders for the wheels, and combined cubes for the chassis. I've found out that using trimesh collision was unstable for the wheels, and not necessary for the chassis/body.
About your track, your car didn't have traction enough to go uphill, or there was no collision with the track?
I've seen your video before, it is looking nice!
First post updated with some of the tracks being made!
- Edited
@Saitodepaula said:
About the collision mesh, I'm using the default Godot shapes: cyllinders for the wheels, and combined cubes for the chassis. I've found out that using trimesh collision was unstable for the wheels, and not necessary for the chassis/body. Oh wait, even if using the VehicleBody and VehicleWheel, you need to make collisionshapes around the wheels aswel? I only have a collionshape (just a simple box) around the body of the car and not around the wheels. Maybe that's why my car keeps screwing up in tracks with slight slopes?
About your track, your car didn't have traction enough to go uphill, or there was no collision with the track? The Friction Slip and Engine Force where alright. Somebody on youtube told me my collisionmesh of the road might be to low poly. So I set the segments back to smaller sections (of 1 metres). That helped with driving uphill again (didn't know a collionshape needs that "high" poly), but it still jumps from time to time at certain sections.
I find it odd that when you create a path in Godot and put a CSGPpolygon on it, you set set that "mesh" as a collision detector. So I don't understand why I can't do the same for the road I created in Blender. Just to import it and select the mesh to be a collision aswel. I can understand I need to create a collision mesh for the invisible walls, so you don't slide of, but for the road...
I've seen your video before, it is looking nice! Today I made the start of a small section of the track. I've noticed for me it's hard to lay down a path and afterwards creating stuff around it. So I just create set-pieces (also because of the Split Second inspiration) and when I got a few of them, I'll stitch them together. Tested it just now: I like the shape of the road, but still issues regarding the collision when driving on it.
- Edited
@eyeEmotion said: Oh wait, even if using the VehicleBody and VehicleWheel, you need to make collisionshapes around the wheels aswel? I only have a collionshape (just a simple box) around the body of the car and not around the wheels. Maybe that's why my car keeps screwing up in tracks with slight slopes?
Hum, no, you don't need to use collision shapes for your VehicleWheels class. I've tried it before and the results were no good.
This node also acts as a collider to detect if the wheel is touching a surface.
@Saitodepaula said: Hum, no, you don't need to use collision shapes for your VehicleWheels class. I've tried it before and the results were no good. I noticed :). I tried it and my car was jumping around even worse.
I still don't get why it isn't a smooth ride when you create roads that go uphill or downhill. On a flat surface, everything seems to mostly run smooth, but as soon as you introduce a real road, problems happen. The 2 things that annoy me right now to the brink of just giving up is that driving uphill makes the car lose a lot of velocity/speed. Not 5km/h but 20 to 30 to even 50km/h. That just won't do. The other thing that annoys me is that although my collison-mesh for the road has enough geometry (as you can see in the image), on sections that aren't flat, it drives like it is off-road, while it needs to drive like it is on tarmac. So the car is constantly wobbling a bit. I've found a setting in the Project Settings at Physics > 3D > Smooth Trimesh Collision and enable it. That seems to help somewhat, but still not enough.
And looking online for answers, coming across lots of examples of car-games in Godot, they all seem to have a few things in common: all rather floaty, all losing speed when driving uphill and all being wobbly when not on a flat surface. Which makes me wonder if Godot is even capable of handling racegames that aren't the floaty/wobbly kind. The Vehiclebody is a nice class/node, but it still to be lacking a lot (especially when you more of a designer than a programmer). And it makes it harder because the documentation/tutorials don't seem to be there to help you address these problems. Seems like Godot is still more something for programmers and not so much for designers (at least regarding [3D] racers).
I have to weigh in that I might have to create my game in Godot alongside an other engine like Unity or Unreal to see which one is more "friendly" to 3D racers for people who are more designers than programmers.
- Edited
In real world physics terms wheels utilize friction to drag the car up the hill, without drag the wheels would just skid and do effectively nothing towards crawling up the slope. Not sure if that observation is in any way useful though.
Sidenote: the only driving thing I've developed was in blender game engine about 10 or so years ago, bullet physics was a thing, but there was never any kind of vehiclebody solver in that implementation. Similar to @Saitodepaula solution here I had to just build my own custom solution.
@eyeEmotion
Everything you have written, I've noticed when trying VehicleBody and Wheel nodes. Another thing you can do, is set physics FPS to 120 (PROJECT > PROJECT SETTINGS > PHYSICS > COMMON).
The other thing that annoys me is that although my collison-mesh for the road has enough geometry (as you can see in the image), on sections that aren't flat, it drives like it is off-road
Godot's collision shapes behave in weird ways sometimes. Take a look at this.
In real world physics terms wheels utilize friction to drag the car up the hill, without drag the wheels would just skid and do effectively nothing towards crawling up the slope. Not sure if that observation is in any way useful though.
It is useful, a lot. After noticing it, it was one of the reasons I switched to a custom approach, so that I can more easily control the friction.
@Saitodepaula said: Godot's collision shapes behave in weird ways sometimes. Take a look at this.
That's a good observation, it's probably "best practice" to cut the track and it's collision mesh up into multiple parts.
@Saitodepaula said: Everything you have written, I've noticed when trying VehicleBody and Wheel nodes. Another thing you can do, is set physics FPS to 120 (PROJECT > PROJECT SETTINGS > PHYSICS > COMMON). Wow, that actually fixes a problem(s). Now, after driving, hitting brake actually keeps the car standing completely still. Before, it still managed to get a little bit speed to go either backwards of forward, depending on what was the last thing you pressed. And strangely, now the car slows down when letting go of accelerate. Just in very small steps, still takes too long, but that means it has"drag" built into it, right? Still to slow driving uphill. (in the new video, I have enough momentum to not lose so much speed)
Godot's collision shapes behave in weird ways sometimes. Take a look at this. Ok, that gives a very good perspective. Watching it closely, that seems exactly what is happening while driving. Made a new video with the wobbly physics (this is also after your suggestion to setting the physics to 120fps)
It is useful, a lot. After noticing it, it was one of the reasons I switched to a custom approach, so that I can more easily control the friction. Too bad I'm not that good at programming anymore (can program a little bit still) and don't know game-engines enough to find these kind of solutions.
First post updated with photo mode!
First post updated with new vehicle: truck!
It's looking better. Nice.
Anyone: Why would I want to drive a trailer truck in a stunt track? TrackMaster: Why not?
First post updated with lots of information about what the game actually is and what is planned!
Also, check the website, it was completely improved with much more info!
- Edited
Cool truck! Did you make it yourself? [stupid question, your website says you have done 3d-modelling before ;) ]
I see you have drifting mechanics. How did you achieve that? I'm still using VehicleBody though.
Cool truck! Did you make it yourself? [stupid question, your website says you have done 3d-modelling before ;) ]
No question is stupid :# ! I can make a truck like that, but it would take me lots of time. I've modified an existing model. There are lots of CC-0 3D models in BlendSwap and Sketchfab, just to name a few. The model I've used is this one: https://www.blendswap.com/blend/20912
I simplified it, remade most of it and switched the tires. Anyway, I'll place this link in the credits portion of the game.
I see you have drifting mechanics. How did you achieve that? I'm still using VehicleBody though.
I didn't actually tried to make drifting mechanics. It worked this way when I made a RWD vehicle with my setup. It was actually quite realistic, and actually not much fun, because it was too hard to turn, and when accelerating, it was too unstable.
I think the key for drifting is to not have too much grip (or friction in case of Godot's physics material or FRICTION SLIP in case of VEHICLE WHEEL node), so that, once you achieve a certain speed, if you turn, your vehicle won't topple over, instead, it will slide. Of course this will work when combined with the friction of the ground material.
@Saitodepaula said: I think the key for drifting is to not have too much grip (or friction in case of Godot's physics material or FRICTION SLIP in case of VEHICLE WHEEL node), so that, once you achieve a certain speed, if you turn, your vehicle won't topple over, instead, it will slide. Of course this will work when combined with the friction of the ground material.
I've tried adjusting friction slip, but I still have to find a value that works. I get some strange behaviour when I try to change that value, which just make the car to an immediate 180° turn. When my VR setup is done, I'm going to try and look into that Raycasting thing, since I apparantly have to abandon that VehicleBody because of the sudden jumps of Bullet-physics collisions. Wouldn't want anyone the get a sudden jump in VR, guess that would be vomit-inducing :#