Class: PhysicsManager
씬 객체에 물리효과를 적용하는 책임은 PhysicsManager이 맡는다. 물리효과를 적용할 객체들에게만 물리효과를 적용한다. 참고한 사이트 https://github.com/tutsplus/ImpulseEngine/ https://github.com/Kareus/SP2C/ https://kareus.tistory.com/15
Description
Usage
new PhysicsManager()
Members
(static) physicsEnableGameObjectList
물리효과가 적용될 객체들
Properties:
Type | Description |
---|---|
array |
Methods
(static) update(scene, deltaTime)
씬 객체 내에 존재하는 오브젝트들중 물리효과가 켜진 오브젝트들에게 물리효과를 계산해 적용한다.
Parameters:
Name | Type | Description |
---|---|---|
scene
|
GameObject |
현재 씬 |
deltaTime
|
number |
이전 프레임과 현재 프레임의 시간차 |
(static) collectPhysicsEnabledGameObjectToList(scene)
씬 객체 내에 존재하는 모든 오브젝트들중 물리효과를 받는 오브젝트들만 모아 리스트에 담는다. 모든 객체를 조사해야하기 때문에 재귀호출하여 탐색한다.
Parameters:
Name | Type | Description |
---|---|---|
scene
|
GameObject |
현재 씬 |
(static) applyImpulse(objA, objB, normal)
두 객체에게 충격량을 적용한다.
Parameters:
Name | Type | Description |
---|---|---|
objA
|
GameObject |
서로 충돌한 객체1 |
objB
|
GameObject |
서로 충돌한 객체2 |
normal
|
Vector |
반작용 방향 |
(static) applyFriction(objA, objB, normal, j)
정지 마찰 계수와 운동 마찰 계수를 통해 마찰력을 적용한다.
Parameters:
Name | Type | Description |
---|---|---|
objA
|
GameObject |
서로 충돌한 객체1 |
objB
|
GameObject |
서로 충돌한 객체2 |
normal
|
Vector |
반작용 방향 |
j
|
number |
충격량 |
(static) positionalCorrection(manifold)
충돌처리가 되었지만 서서히 빠져버리는 버그를 해결하기 위해 충돌된 위치에서 정해진 값만큼 강제로 떨어지게 한다.
Parameters:
Name | Type | Description |
---|---|---|
manifold
|
Manifold |
충돌체크의 결과 |