- Home /
Floating player
I'm making a game where the player floats.
Early test video: http://www.youtube.com/watch?v=h_MM3jV8BrA
But, I still need it to respect physics and collide with the ground mesh collider.
I added a parent GameObject with a child floating cube to make the camera follow a fixed position instead of the floating cube. Worked OK.
But, when I move the player over a higher ground, it sinks into asphalt (LOL).
I need the floating object middle point to float at an exact altitude over the ground.
How to achieve that?
Thank you.
Answer by OP_toss · Apr 10, 2013 at 02:36 AM
Use a CharacterController on a GameObject. This will slide along the ground and climb certain angles etc. Pretty useful.
Adjust its collider to be lower or taller than the cube. Place the cube under the CC and only "float" its local position.
Then change your movement code to use CharacterController.Move which respects collision.
Your answer
Follow this Question
Related Questions
how to move an object in a curved way 4 Answers
Making a bubble level (not a game but work tool) 1 Answer
When I look down and move forward, I fly upwards 0 Answers
Hovercar-like movement? 1 Answer
Realistic 2D flight physics? 0 Answers