I would like to do circular motion while tapping Unity 2D, and when I release it, I would like to do a circular motion to fly the object in the direction where the force was working, but I didn't know where the object started and how to fly it when I spoke.
Currently, circular motion is possible, but circular motion is not performed from the location of the object, but from the location specified by the code.
I look forward to your kind cooperation.
unity3d unity2d
If you can move it from the place specified by the code, I think it would be good to start with the gameObject.transform.localPosition of the object you want to start with, but isn't it the intended place?
Also, if the process of flying when the touch is released is easy, I think it will look like that if you use (current coordinates - previous coordinates) as a vector and fly it in that direction.
However, if you use Time.deltaTime for circular motion calculations, the results will vary depending on the frame rate, so if you want to do it strictly, you can't do this.
© 2024 OneMinuteCode. All rights reserved.