- Home /
Other
Arrow fires at wrong rotation
Hello beautiful people of the internet!
I come to you with the following question: As I am relatively new to scripting, I can't figure out how to make an instanced object face the right direction. I have created a launcher object, attached it to the bow which fires the arrows, and everything works, except that when the arrow launches its facing down ( like this | and not like this -)
This is the script attached to the Launcher object
var throwSound : AudioClip; var ArrowObject : Rigidbody; var throwForce : float;
function Start () {
}
function Update () { if(Input.GetButtonUp("Fire1")){ audio.PlayOneShot(throwSound); var newArrow : Rigidbody = Instantiate(ArrowObject, transform.position, transform.rotation); newArrow.name = "Arrow"; newArrow.rigidbody.velocity = transform. TransformDirection(Vector3(0,0, throwForce));
} }
Any help would be very appreciated!
EDIT: Figured it out, had to change rotation in the prefab section :) Silly me!
hello beautiful queetioner!
check out the "LookAt" command, plenty of doco ... it may help