Hey there, I’ve run into this issue while trying to make a forklift simulator.
I’ve written some code that allows you to pick up and place a container onto the forklift.
It simply takes the gameobject of the container, parents it to a transform representing it’s location on the forklift, resets it’s position and rotation and disables it’s BoxCollider.
The forklift itself uses WheelColliders and physics to simulate “Realistic driving”, but I had to freeze the truck’s X and Z rotation to keep it from flipping over. This works, until I added the container.
As soon as you try to make a corner with the forklift, it starts tipping over and it keep rotating.
See image:
There are no extra physics on the container. I tried disabling the boxcollider, ignoring it, setting IsTrigger to true or removing it outright. But it keeps rotating as such.
Can someone tell me why this happens, even though I’ve frozen rotation on the single Rigidbody in the hierarchy?
EDIT: I’ve added a container with no collider to the forklift in the editor and it didn’t show this behavior.
But when I do this at run time it still does…
EDIT 2: SOLVED… I’ve changed the code to disable the collider first BEFORE moving it onto the forklift.
That seems to have solved it, but it’s still strange to me… you’d think that all the code is ran at the same frame and wouldn’t interfere with each other like that…