x


Object facing the wrong way?

So I'm basically writing an application that requires a capsule to point towards the bottom of another object. My problem is that if I use "LookAt" then the capsule points 90 degrees away from it because the capsule isn't pointing in the correct direction initially. Is there any way to change this?

My code is the following:

var Target1: Transform;
var Self1: Transform;

function Update () {
    var targPosition: Vector3 = new Vector3(Target1.position.x, Target1.position.y - 1, Target1.position.z); 
    Self1.LookAt(targPosition);
}

Thanks in advance

more ▼

asked Aug 02 '10 at 07:02 PM

ROM gravatar image

ROM
262 46 49 58

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

1 answer: sort voted first

create a empty gameObject and make the capsule a child of the empty.

then rotate the capsule 90 degrees. and remove the script from the capsule and add it to the empty

more ▼

answered Aug 02 '10 at 07:08 PM

3dDude gravatar image

3dDude
2.6k 65 76 103

(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:

x2169
x1095
x329
x322
x132

asked: Aug 02 '10 at 07:02 PM

Seen: 1523 times

Last Updated: Aug 02 '10 at 07:02 PM