- Home /
Projectile(Arrow) angle during flight is not realistic
I'm shooting an arrow and I've got a small problem..
The arrow model itself is obeying a decent trajectory, but it doesn't look realistic because the arrow doesn't change angle during flight..
What would be the best way to have the arrow angle upwards a little bit until it reaches the peak of the trajectory, and then begin to angle downwards? If there were some way to tell the unity physics engine the mass of each part of the arrow, I imagine that it may be able to create a more realistic trajectory - but I'm assuming I will have to do this with a MonoBehaviour..
Any help is much appreciated - thank you for your time..
When you look at your arrow model in Unity - which of the gizmo axes does it point along?
And sorry, I forgot to ask - you are using rigidbody or something else to move it?
Answer by whydoidoit · Jun 16, 2012 at 04:15 PM
So this will work in any case:
var lastPosition : Vector3;
function LateUpdate() {
var direction = (transform.position - lastPosition).normalized;
lastPosition = transform.position;
transform.forward = direction;
}
You could use the rigidbody velocity and dispense with the tracking of the position if you are using physics.
This seems to cause some odd problems.. Possibly due to how I'm doing other things.. I'll post an update after I've tinkered some more..
Thanks for your help $$anonymous$$ike.
Yeah it could well do. You probably want to have the arrow on a separate game object that is a child for this to work.