Does Unity have any built-in support for confining/constraining the movement of Object A to being only on the surface of a non-planar mesh Object B?
I am not entirely sure if I understand your question. Do you want to constrain (player) movement along the surface of a mesh?
Yes - say, the player is Object A, is there a way to constrain / confine movement to just the surface of an arbitrary mesh Object B
Answer by Jesse Anders
Dec 16, 2010 at 01:32 PM
No, there's no built-in support for this. (The behavior you describe is very specific and isn't the sort of thing Unity would be likely to support directly.)
However, the topic has been discussed quite a bit both here and on the forums, and if you search for e.g. 'mario galaxy' you should find some relevant threads. (In short, a fairly common solution is to cast a ray downwards relative to the object, and if there's an intersection, move the object to the intersection point and align the object with the surface normal at that point.)
i've also found that iTween seems to do a good job at this
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
No one has followed this question yet.
transform.active question - Model Mesh Scripting
Camera distance from mesh not center
Move from center and not pivot.
Movement on roads issue
Detecting transforms showing up in a camera