|
Hi all, I am creating a top down 2D shmup and have successfully instatiated a bullet prefab. During the Start Handler the bullet converts the 2d mouse coordinates into 3d World coordinates. The difference current position (player) and mouse is normalised to create a vector that i use in the Update handler. The trouble is the bullet plane and texture which is rectangular needs to be rotated toward the in the angle of this vector. I am using eularAngles to rotate the prefab Ive even tried hardcoding an angle in but don't seem to be getting a result:- transform.eulerAngles = new Vector3(0, 0, 20); Here is the scipt:- function Start(){
}
(comments are locked)
|
|
Have you tried Transform.LookAt? You may need to make the bullet a child of something if the bullet model is rotated by default such that its Z axis is not forward. Agreed, I would probably just use LookAt() in this situation.
Jan 06 '11 at 03:42 PM
PrimeDerektive
(comments are locked)
|
