var arrow:Transform;
var shootforce:float;
function Update () {
if(Input.GetMouseButtonUp(0))
{
var instanceArrow = Instantiate(arrow, transform.position, transform.rotation);
instanceArrow.rigidbody.AddForce(transform.forward * shootforce);
}
}
This code shoots an arrow ahead of a first person controller, but it has some problems.
The arrows are backwards, the tip faces the character. It shoots it too low, it should be higher up. It shoots in the right direction, but if you look up it still shoots as if you're looking straight ahead. (This one may be more complicated, since it would need to rotate in the direction the arrow is facing while moving. You know how arrows work.)
Any tips?