[Unity] Rigidbody(물리법칙)

박호준·2022년 2월 11일
0

Unity

목록 보기
2/17

추가 : Add Component => physics => rigidbody

  • Mass : 질량
  • Drag : 저항(공기저항)
  • Angular Drag : 회전 저항
  • Use Gravity : 중력
  • Is Kinematic : 물리효과없애기
  • Interpolate : 움직임 예측
  • Collision Detection : 충돌 탐지
  • Constraints : 위치값 고정

ADD{}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class rigidbody : MonoBehaviour
{
   private Rigidbody myRigid;
   void Start()
   {
       myRigid = GetComponent<Rigidbody>();
       rotation = this.transform.eulerAngles;
   }

   void Update()
   {
       if (Input.GetKey(KeyCode.F))
       {
           // myRigid.velocity = Vector3.forward; 정지
           // myRigid.angularVelocity = Vector3.right; 회전
           // myRigid.maxAngularVelocity = 100; 회전 속도


			rotation += new Vector3(90, 0, 0) * Time.deltaTime;
			myRigid.MoveRotation(Quaternion.Euler(rotation); // 물리법칙 x 이동
           
            myRigid.AddForce(Vector3.forward); // 물리법칙 영향 이동
           
           
           
			myRigid.AddExplosionForce(, 위치, 반경)
       }
   }
}
profile
hopark

0개의 댓글