- Home /
How to smoothly move player in circular shape around a point??
Currently I am using this code to move player in circular motion.
float x = CrossPlatformInputManager.GetAxis("Horizontal") * Time.deltaTime * speed;
transform.RotateAround(pivot.position, new Vector3(0,0,1), x);
everything is working fine but when I putt off hands from controls, it still moves slowly. to stop that I have to press opposite button. and first it stops and again I have to press the button to move it reverse.. Sorry I am absolute beginner to unity..
First, try it with GetAxisRaw which always gives you -1, 0, or 1 (no smoothing) to make sure that that will at least prevent it from moving constantly.
Your code seams to be fine and it works for me just fine, maybe it's some issue with your controller. I used keyboard, so I had only -1, 0, 1 cases, if you using other controller you can have some in between values, which can causes this problem.
bro it works absolutely perfect with Input..GetAxis("Horizontal") but I want to make it work with CrossPlatformInput$$anonymous$$anager.GetAxis("Horizontal") and still its not working,, I am using Axis Touch Button Script for UI buttons.
Answer by TheChosen123 · Jan 06, 2019 at 09:59 PM
try this:
float x = speed * 5 * Input.GetAxis("Horizontal");
transform.Rotate(0, x, 0);
you will need to make a float speed
Your answer

Follow this Question
Related Questions
Get angle around a specified axis. 1 Answer
Move an object forward. But not up 1 Answer
Vector3 - Rotate a cube by its spatial (longer) diagonal 1 Answer
Rotate to face the bottom of a unit towards a planet 0 Answers
How to Rotate Plane of Cube Around its Center? (Rotate Vectors Around Point/Axis/Direction) 1 Answer