Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Rotating an object in Unity

using UnityEngine;

public class Rotation_demo : MonoBehaviour
{
    Vector3 rot=new Vector3(10,10,10);
  
    void Start()
    {
       transform.Rotate(rot);
        
    }
}
Comment

rotate gameobject unity

Transform.Rotate(Vector3 eulers)
// you can add relativeTo=Space.Self for it to rotate arround itself or do
// relativeTo=Space.World to rotate relative to the scene
// https://docs.unity3d.com/ScriptReference/Transform.Rotate.html
Comment

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);
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# make request to rest api 
Csharp :: two variable in one loop in one line c# 
Csharp :: top down movement unity 
Csharp :: c# unity detect any keyboard input 
Csharp :: get roaming folder c# 
Csharp :: c# environment variables 
Csharp :: unity log warning 
Csharp :: unity show colliders 
Csharp :: newtonsoft create dynamic object 
Csharp :: serilog set log level 
Csharp :: disable rigidbody unity 
Csharp :: get enum value from display name c# 
Csharp :: dynamic arrays in c# 
Csharp :: get type of variable c# 
Csharp :: c# foreach on a dictionary 
Csharp :: c# for loop 
Csharp :: nested dictionary c# 
Csharp :: unity round float to nearest 10 
Csharp :: Throw index out of range C# 
Csharp :: optimistic update 
Csharp :: wpf mouse over style trigger 
Csharp :: how to use navmeshagent in unity 
Csharp :: how can prevent the empty input in jquery 
Csharp :: raylib c# basic window 
Csharp :: c# getting user input 
Csharp :: create new .net project 
Csharp :: unity find child by name 
Csharp :: get list length c# 
Csharp :: or in if statement c# 
Csharp :: c# list of properties from list of objects 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =