• 3D
  • Wheelchair-like movement & physics for a 3d game

Hello, I'm new to Godot (also to 3d games) and wanted to ask a question for my project.

I will create vehicles with 2 (like wheelchair, not bicycle) or 4 wheels but the movement style will be different than cars. Also since it will be a multiplayer game and players will interact with each other's vehicle I think my only choice is rigidbody. But I don't know if I need to add the wheels as normal wheels or add them as rigidbodies as well; use pin joint or another method to connect them to the vehicle body, use separate engines on different wheels to get the desired movement style (see below) etc. I need some suggestions here. Shall I follow normal car tutorials and do modifications or need to do something totally different and if so where can I start. I've read some documentation but couldn't be sure which one would fit here.

Movement will be like (it'll be very high paced game, accelerating/decelerating to full speed/zero will happen in under 1 second):

Pressing "W": All the wheels' speed will be 255. When the key released, the vehicles will stop in less than 1 second. Pressing "S": All the wheels' speed will be -255. When the key released, the vehicles will stop in less than 1 second.

And now the tricky part:

Pressing "D": Wheel(s)'s on the right side speed will be -155 and the left wheel(s)'s will be 155. Pressing "A": Wheel(s)'s on the left side speed will be -155 and the right wheel(s)'s will be 155. Pressing "A" and "W" at the same time, wheel(s)'s on the left side speed will stay as 0 and the right wheel(s)'s will be 255. Pressing "A" and "S" at the same time, wheel(s)'s on the left side speed will stay as 0 and the right wheel(s)'s will be -255. Pressing "D" and "W" at the same time, wheel(s)'s on the right side speed will stay as 0 and the left wheel(s)'s will be 255. Pressing "D" and "S" at the same time, wheel(s)'s on the right side speed will stay as 0 and the left wheel(s)'s will be -255.

I didn't go into depth about your posts. But as always when you introduce a "different" type of vehicle you've got to do some research about the physics about the physics and then (like you obviously did a bit) make up your thoughts how to adapt this inside godot.

There's a vehicle demo. You could start by altering one of the vehicles to mimic a wheel chair and see if you can work with that.

A Wheelchair often has 4 wheels. 2 big ones and also 2 small ones for stabilizing.

You'll see that (standard) collision shapes will play a role in the physics engine. The mesh itself does't play a role (despite the visuals, naturally).

There are motors in certain physics joints (i.e. https://docs.godotengine.org/en/3.1/classes/class_generic6dofjoint.html ).

The big wheels of wheelchairs, similar to bikes also have some stabilizing "gyroscope" effect which (as far as i know) will not be automatically simulated by the physics engine. But I might be wrong with that (didn't bother so far). Anyway you could "emulate" that by watching the bodies velocities (and changes over time) in physics_process or integrate_forces and add "stabilizing" counter-forces. Roughly said. But perhaps that is going to far.

Something important to know about raycast vehicles such as the built-in VehicleBody/VehicleWheel is that the wheels themselves are just an illusion and only actually collide with the point on the ground directly below them. For these kinds of vehicles, the suspension behavior is more important than the wheel collisions. It's not as big of a deal when the wheel is small relative to the vehicle, but this limitation will become noticeable when you need the sides of the wheels to bump into things.

Since (presumably) your wheelchair doesn't need a suspension, you might want to start with trying the joint approach to hook on actual wheels. Unfortunately I haven't tried this myself to know what sort of issues might pop up, but I know that one of the bullet vehicle examples does it this way: https://github.com/bulletphysics/bullet3/blob/master/examples/Vehicles/Hinge2Vehicle.cpp

I'd love to experiment with hybrid approaches myself someday in order to gain the best of both worlds, but just don't have the time for it right now.

No matter what approach you take, you're definitely going to have to lower your center of gravity and possibly fudge some other things if you want to take off that fast without doing a wheelie B)