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?

more ▼

asked Dec 16, 2010 at 12:41 AM

avatar image

4.7k 1634 1280 1330

I am not entirely sure if I understand your question. Do you want to constrain (player) movement along the surface of a mesh?

Dec 16, 2010 at 12:46 AM Statement

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

Dec 16, 2010 at 12:48 AM ina
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.)

more ▼

answered Dec 16, 2010 at 01:32 PM

avatar image

Jesse Anders
7.8k 13 33 67

i've also found that iTween seems to do a good job at this

Dec 23, 2010 at 04:15 AM ina
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Dec 16, 2010 at 12:41 AM

Seen: 2300 times

Last Updated: Dec 16, 2010 at 12:49 AM