Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

codingfarm

이동 본문

Unity3d

이동

scarecrow1992 2022. 2. 21. 21:49

 

 

트랜스 폼

1
2
3
4
5
6
7
8
9
10
Vector3 velocity;
 
public void Move(Vector3 _velocity) {
    velocity = _velocity;
}
 
public void Update() {
    transform.Translate(velocity * Time.deltaTime);
}
 
cs

 

 

 

물리엔진

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Vector3 velocity;
Rigidbody myRigidbody;
 
void Start() {
    myRigidbody = GetComponent<Rigidbody> ();
}
 
public void Move(Vector3 _velocity) {
    velocity = _velocity;
}
 
public void FiedxUpdate() {
    myRigidbody.MovePosition(myRigidbody.position + velocity * Time.fixedDeltaTime);
}
cs

 

 

 

 

'Unity3d' 카테고리의 다른 글

시간  (0) 2022.02.21
생성  (0) 2022.02.21
Ray  (0) 2022.02.21
코루틴  (0) 2022.02.20
5. 2d 플랫포머 - 내리막 길  (0) 2020.08.02
Comments