x


How do I calculate the offset for

I want to use transform.LookAt on a number of different transforms. The only problem is that the transforms are all oriented in different directions (their global x, y, and z are all pointing different directions). So when I use LookAt, they objects appear to flip in funny directions compared to how they started.

I can't change the transform's starting orientations in the modeling program, because they actually need to be the way they are.

So what I am trying to do is figure out how to get the same effect as LookAt but take into account the offset orientation that they start with.

Ideas?

more ▼

asked Dec 02 '09 at 04:46 PM

Joe 1 gravatar image

Joe 1
3 1 1 2

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

you could make them a child of a new gameobject, and then call LookAt on the new gameobject's transform. That would maintain the child's transform relative to the parent, rather than overriding it.

more ▼

answered Dec 02 '09 at 04:58 PM

Azound gravatar image

Azound
668 19 23 39

(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

By RSS:

Answers

Answers and Comments

Topics:

x2244

asked: Dec 02 '09 at 04:46 PM

Seen: 962 times

Last Updated: Dec 02 '09 at 04:46 PM