- Home /
how to make 2D gameObject z-rotation smoothly rotate like an arrow when being launched in any direction to a target?
I've tried Quaternion.LookRotation(), Quaternion.AngleAxis(), I transform.rotation = LookAt2D(nextPos - transform.position); static Quaternion LookAt2D(Vector2 forward) { return Quaternion.Euler(0, 0, Mathf.Atan2(forward.y, forward.x) * Mathf.Rad2Deg); }
I'm using Unity2018.3.0f2 I'm basically trying to figure out the complete proper way of the launching functionality of using a cannon with a z-rotation to point an arrow in any direction and an arrow using z-rotation to look more realistic when being launched and reaching the target.
How to use a cannon to launch an arrow in an arch motion
I'm trying to figure out how to mimic a z-rotation of an arrow flying up or straight depending on the cannon z-rotation then smoothly facing the target when going down to the target. Thank you in advance =)