Answers for "Rotating an object in Unity using Physics"

C#
0

Rotating an object in Unity using Physics

using UnityEngine;

public class rotation_example : MonoBehaviour
{
    public float torque;
    public Rigidbody rig;

    void Start()
    {
        rig = GetComponent<Rigidbody>();
    }

    void FixedUpdate()
    {
        rig.AddTorque(transform.up * torque);
    }
}
Posted by: GonaRip on June-22-2022

Code answers related to "Rotating an object in Unity using Physics"

C# Answers by Framework

Browse Popular Code Answers by Language