- Home /
Question by
lolopset192 · Oct 17, 2018 at 08:55 AM ·
2dvector22d rotation
How do I rotate arround an object by swiping left or right?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Ring_Script : MonoBehaviour {
public Rigidbody2D rb;
public float moveSpeed = 600f;
float movement = 0f;
// Update is called once per frame
void Update () {
movement = Input.GetAxisRaw("Horizontal");
}
private void FixedUpdate()
{
transform.RotateAround(Vector3.zero, Vector3.forward, movement * Time.fixedDeltaTime * -moveSpeed);
}
Comment