Controller like Rolly Vortex
Hello, I am working a game like Rolly Vortex. I have a problem about it. While Im swiping left or right, ball is going well but it affects the movement speed and I cant get that smooth controller like Rolly Vortex. Is there any tip for that? Basicly I want to move player to left or right with my finger. While doing that, ball will go constantly move on z axis. Any tips?
private void Update()
{
if (Input.touchCount > 0)
{
if (Input.touchCount == 1)
{
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Moved)
{
Vector2 touchDeltaPosition = touch.deltaPosition;
TranslateBall(touchDeltaPosition, 0.3f);
}
}
}
} private void FixedUpdate()
{
rb.AddForce(Vector3.forward * speed);
}
public void TranslateBall(Vector2 position, float translationSpeed)
{
transform.Translate(position.x * translationSpeed * Time.deltaTime, 0f, 0f);
}
Comment
Your answer
Follow this Question
Related Questions
Swipe single object at a time upon touch, not swiping allover the screen 0 Answers
How do I obtain smooth movement of a 3d object on an int grid? 0 Answers
Movement smoothing stopped working. 1 Answer
Foreach loop stuck. Trying to get smooth movement. 2 Answers
Unusual movement script. Any ideas how to do that? 0 Answers