Godot Version
4.7
Question
So I am making a game about a forklift that needs to pickup and deliver objects. The forklift is composed of the drive (Vehicle Body 3d), which is a parent of the fork.
the thing is, the fork needs to obviously follow the forklift, while still being able to move up and down as I control it. at first i just used a static body for the fork, and changed its position directly via code. however, this had the problem that the fork was able to clip through walls, even when a collision for it was set.
I tried changing the fork to a character body, which solved the clipping through walls problem. however, because it was a character body, it was “semi-independent” from the forklift: it still followed the forklift nicely, but if I, for example, drove straight into a wall, the fork could “deattach” from the forklift (it would still follow the forklift, but would be displaced).
so i tried a animatable body. I had never used an animatable body before, so I may have been using it wrong, but I was just setting its position via code directly (like at first with the static body). however, for some reason, the fork would move along the y axis when controlled normally, but would remain static if the forklift moved (like if the fork was top level, but it wasnt). this issue persisted even when I was setting the fork position to be at the forklift
currentForkHeight += delta * currForkVel
currentForkHeight = clampf(currentForkHeight, 0.0, MAX_FORK_HEIGHT)
$Fork.global_position = $"fork pos reference".global_position
$Fork.global_position.y = defaultForkHeight + currentForkHeight
so i am in a “limbo” state where any of my approaches didnt work for a different reason, and would appreciate any guidance.
thank you all in advance





