Move Player With Moving Vehicle
Hi I am trying to be able to move my 3rd person character while on top of a moving bus. I've tried parenting but that doesn't seem to work. The bus uses a Rigidbody with Gravity checked. And my 3rd person character has a Rigidbody but the physics are in the code, so neither Kinematic nor Gravity are checked. But whatever I do, the player slides off. Any ideas?
Answer by Infenix · Jan 20, 2021 at 01:58 PM
If you're character also have a Rigidbody, I would try to get the current vehicle velocity, set it as the player's velocity if he touches the vehicle, and then add to it the character local velocity from controls. Maybe each frame save the velocity and remove it on next frame from vehicle velocity to get previous character's velocity. never tried it so that's just a proposition, no idea if it will work but I think it can.
Thanks for the response but I figured out a different solution. For anyone co$$anonymous$$g across this: Put a Trigger on top the bus. Didn't parent it to the bus. Created a script for the trigger to follow the bus (like a camera would follow a player). Then when the player enters the trigger, the player gets parented to the Trigger. Worked like a charm.
Your answer
Follow this Question
Related Questions
Counteracting rigidbody velocity using AddForce? 0 Answers
Realistic Soccer Ball Dribbling? 1 Answer
How to make rigidbody not effect movement while still using it for collisions? 0 Answers
Player going through walls 1 Answer
Player (RigidBody) jitters when colliding with object and jumping. 0 Answers