Different ways to rotate a gameobject in unity3d
Rotate rigid body stats at : 1:40
Code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotator : MonoBehaviour
{
public Vector3 speed;
public float torqueforce;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
// transform.Rotate(speed*Time.deltaTime);
//////// if your gameobject is child of some other object ///////////
//transform.localEulerAngles += speed * Time.deltaTime;
/////////////// if your game object has a rigid body //////////
// GetComponent lessThanSign Rigidbody greater than Sign().AddTorque(transform.up*torqueforce*Time.deltaTime,ForceMode.Force);
}
}