How do I calculate the point on a ground plane relative to another object?

Godot Version 4.2

I am an absolute noob when it comes to 3D games and have loads to learn. I am looking for some advice on what to learn and understand to be able to do the following.

I am playing around with the VehicleBody3D and have got a small box-shaped “car” driving around easily enough. I would like to be able to add some skidmarks on the ground plane when the VehicleWheel3D indicates that the wheel is slipping.

This should be done per wheel, and in my initial thinking, 2 ways of doing this comes to mind.

  1. a particle effect emitted as I skid with the position of the wheel.
  2. a path ‘trail’ which is X length being left behind and like a rolling index update when skids occur

My problem is I lack the understanding to know how to get the point to the ground plane in such a way that I can use either of these approaches. Does anyone have a good reference for me to learn about this?

The wheel is rotating, so I was thinking you probably either need to calculate the closest point between the wheel and the ground plane and then cast that down to the ground plane, or use a ray cast or something like that.

I don’t know what to search for to do this :frowning_face: any help would be appreciated

This is my current attempt, just spawning simple cubes to see the effect. But as soon as I turn the placement is off

In particular this section of code:

How do I correctly spawn something at that location?

Kinda got it working by appending the cube to the root. Removes the need to calculate the offset of the node.

get_tree().root.add_child(cube)

And then using the global position of the marker to place the object.

Think this was pretty much the solution for me. I will have to look at how to implement this better in future, for now it’s ok

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.