백지부터 시작하는 이세계 코딩 생활

Angular Drag, Mass, Drag 본문

백지부터 시작하는 이세계 유니티 생활 since 2020

Angular Drag, Mass, Drag

조아덕 2020. 12. 1. 21:22

Inspector 창에서 확인할 수 있으며, Rigidbody Component에서 조작 가능 하다.
(그 밖에 Rigidbody (물리엔진 효과) Component에서 조작 가능한 사항들은 Ref. 를 참고)

Angular Drag

오브젝트의 회전에 대한 저항력(angular drag)을 나타냅니다. 공기저항은 오브젝트의 움직임을 늦추는데 사용될 수 있습니다. 회전에 대한 저항력값이 높을 수록, 회전을 더 많이 늦추게 됩니다.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Rigidbody rb;
    void Start() {
        rb = GetComponent<Rigidbody>();
    }
    void Update() {
        if (Input.GetKeyDown("space"))
            rb.angularDrag = 0.8F;
        else
            rb.angularDrag = 0;
    }
}

Drag

오브젝트의 저항력(drag)를 나타냅니다. 저항력은 오브젝트의 움직임을 늦추는 경우에 사용됩니다. 저항력이 높으면 오브젝트가 느려집니다.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Rigidbody rb;
    void Start() {
        rb = GetComponent<Rigidbody>();
    }
    void OpenParachute() {
        rb.drag = 20;
    }
    void Update() {
        if (Input.GetButton("Space"))
            OpenParachute();
        
    }
}

Mass

리지드바디의 질량을 나타냅니다.
더 높은 질량값을 가진 오브젝트는 충돌 시에, 더 낮은 질량을 가진 오브젝트를 밀어냅니다.

주의사항 : 너무 높은 값으로 질량을 설정하는 경우, 물리 시뮬레이션이 불안정해 진다.
무게와 질량의 개념을 혼동하면 안된다.
질량 : Object 고유의 양
무게 : Object 질량 + 중력에 의한 값

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public float mass;
    public Rigidbody rb;
    void Start() {
        rb = GetComponent<Rigidbody>();
        rb.mass = mass;
    }
}

 

 


Ref.

docs.unity3d.com/kr/530/ScriptReference

 

Unity - 스크립팅 API:

Welcome to the Unity Scripting Reference! This section of the documentation contains details of the scripting API that Unity provides. To use this information, you should be familiar with the basic theory and practice of scripting in Unity which is explain

docs.unity3d.com

 

m.blog.naver.com/PostView.nhn?blogId=dj3630&logNo=221454841202&proxyReferer=https:%2F%2Fwww.google.com%2F

 

[유니티 기초] - Rigidbody

Rigidbody 컴포넌트- 게임오브젝트가 물리엔진의 영향을 받게 만드는 기능을 한다. 따라서 force, torque...

blog.naver.com

Rigidbody Component 들 내용 정리

'백지부터 시작하는 이세계 유니티 생활 since 2020' 카테고리의 다른 글

Memory 구조  (0) 2020.12.04
Shader  (0) 2020.12.01
Class 와 Object 와 Instance  (0) 2020.12.01
FindObjectOfType 와 GetComponent  (0) 2020.11.27
struct 와 Class  (0) 2020.11.26
Comments