Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Rotating an object in Unity usign 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);
    }
}
Source by vionixstudio.com #
 
PREVIOUS NEXT
Tagged: #Rotating #object #Unity #usign #Physics
ADD COMMENT
Topic
Name
6+3 =