How to rotate Cylinder Step by step ?,Cylinder rotate step by step
Hi, how to make my cylinder rotate step by step ?
I want to bounce a ball on it, but I want the slabs to always be on top, that it cannot fall between 2 slabs during the rotation.
i want it to spin like a pistol barrel.
public class CylinderMove : MonoBehaviour {
Vector3 mPrevPos = Vector3.zero;
Vector3 mPosDelta = Vector3.zero;
void Update() {
if (Input.GetMouseButton(0))
{
mPosDelta = Input.mousePosition - mPrevPos;
transform.Rotate(transform.forward, Vector3.Dot(mPosDelta, Camera.main.transform.right), Space.World);
}
mPrevPos = Input.mousePosition;
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613033628im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I flip a player over the Horizontal and Vertical axis? 0 Answers
Making visual wheel rotate together with wheel collider 1 Answer
Mobile Gyroscope, make Camera always rotating towards zero point using Quaternion 2 Answers
Camera self rotation script problem 1 Answer
Get LineRenderer positions or perform a transformation to an array of Vector3s 1 Answer