I try to code moving or shooting an object (bullet, missile etc… ) tp a target when the object reach a distance from origin it should make a loop then resume original direction to the target.
here is an image to show what im after:
Any Tip on how to code this kind of motion with unity JS ?
Thank you for any help.
You can use Mathf.sin() to get numbers between -1 and 1. Sin, Cos, and Tan are all great math tools for solving problems involving circles and curves.
Try to figure out how you can use Mathf.sin(elapsedTime) to get an object moving in a circle, then see if you can make that circle movement happen in the middle of your forward motion.
I’d try to explain, but I’m short on time right now.
i was able to make the motion with simple eulerAngles that being called with a distance switch,
then with a timer limit on the rotation the forward motion restored.