- Home /
Character always standing normal to mesh - without using physics system
Is there an easy way to always have a character (say, a car) always be normal to a mesh (such as hilly terrain)?
I'm trying to understand the question. Do you mean like how sonic's entire character tilts to the angle of the hill in this http://youtu.be/QDTiPAx8Egw
Answer by Lukecovboy · Dec 31, 2012 at 02:38 AM
You need three animations or meshes walking running and stationary
Answer by TomPendergrass · Dec 31, 2012 at 08:08 AM
I've done this before; I had to essentially allow a character to walk on the inside surface of a wheel. I don't have the exact code, but essentially what you need to do is a Physics.Raycast down from the character to the ground. Using the HitOutInfo (explained in the scripting reference) you can retrieve the normal of the face it intersected. By aligning your character's orientation with that of the normal, you'll receive the desired effect.
Here, I did a slideshow presentation on it a long time ago. I hope this helps! https://docs.google.com/presentation/d/1i2-IPJgueGxq--2RHf5ZmfJHUc-iQl6V9GHUD9CFHu4/edit
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Trying to create a hard edged procedural torus mesh 2 Answers
Holes in procedural mesh 0 Answers