- Home /
Confining / Constraining an object transform trajectory to a mesh
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.)
Your answer
Follow this Question
Related Questions
Basic projectile trajectory with transform 1 Answer
Updating new cube face positions after rotation 0 Answers
Why the guismo of the GameObject is at the center but its "mesh" is not at all in the center? 0 Answers
Overlapping meshes create weird rendering problem 1 Answer
How to rotate my character properly while using Head Look Controller 2 Answers