VideoEnTempsReel_Trommel/Assets/Scripts/SimpleRotate.cs

26 lines
541 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimpleRotate : MonoBehaviour
{
public Vector3 axis = new Vector3(0,0,0);
Rigidbody rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
rb.maxAngularVelocity = 5000;
}
// Update is called once per frame
void Update()
{
rb = GetComponent<Rigidbody>();
rb.maxAngularVelocity = 500000000;
rb.AddRelativeTorque(axis);
}
}