35. Havok Rigid Body 컴포넌트
엔터티에 Havok Rigid Body
컴포넌트를 추가하면 물리를 적용할 수
있다
36. Restitution: Defines how bouncy the Rigid Body is. 0
has no bounce, >0 increase more bounce. Default is 0.4.
입력 범위: 0 ~ 1.98
Restitution
Restitution 을 1.98로 설정한 경우
충돌 후에도 힘을 거의 상실하지 않는다
Restitution 을 0로 설정하면
충돌 직후 힘을 모두 상실하면서 멈추게 된다.
37. Friction: Defines the Smoothness of the surface
of this Rigid Body. 0 is smooth, >0 has more
friction applied. Default is 0.5. (입력 범위: 0 ~ 1)
Friction
Friction 을 0 으로 설정하면 마찰력이 없어서
빠르게 미끄러 진다
38. Dynamic: This motion type gives the Rigid body the ability to move around.
It automatically selects the Sphere / Box Inertia motion type depending on
the input Inertia value.
Box Inertia: This Motion type performs the simulation using a box inertia
tensor.
Sphere Inertia: This Motion type performs the simulation using a sphere
inertia tensor
Motion Type
Thin Box Inertia: This Motion type is
the same as the Box Inertia, but is
optimized for thin Boxes and has less
stability problems.
Keyframed: This motion type can be
moved and push other objects
around.
Fixed: This motion type can collide
with other Objects, but does not
move around as it is Static.
Character: A specialized motion used
for character controllers.
Fixed
Keyframed
Dynamic
39. Linear Damping: Defines how strong the
movement of this Rigid Body is reduced over
time. Larger Values speed up the damping on
the velocity of the rigid body. (입력 범위 : 0 ~ 1)
Linear Damping
Linear Damping 을 1 로 지정
하면 마찰력이 없는 상태에서도
속도가 빠르게 줄어든다
40. Angular Damping: Defines how strong the
rotation of this Rigid Body is reduced over time.
입력 범위: 0 ~ 1
Angular Damping
Angular Damping을 1 로 지정
하면 회전 속도가 빠르게 줄어든다
45. Inertia Tensor Scaling
• Factor to scale all components of the intertia tensor with.
• Increasing the inertia will increase the RB’s resistance to changes
in angular momentum. (회전 속도의 변화에 대한 저항값)
• 입력 범위 : 0.001 ~ 1000
Inertia Tensor Scaling
Inertia Tensor Scaling 을 0.001 로
낮은 값으로 지정 하면 충돌로 이후
더욱 빠르게 회전한다
46. Welding is used to reduce the
Problem of objects bouncing
Vision is usually using Anti-
Clockwise
Welding Type
바닥면의 WeldingType 을 None 으로
설정한 상태에서는 바닥 폴리곤의
경계부분 에서 공의 방향이 엉뚱한
곳으로 튀는 현상이 종종 발생 된다
47. Welding 이슈 사례
박스 형태의 강체가 지면과 맞닿은 상태에서 이웃하는
폴리곤으로 이동 하던 중 4개의 Contact Point 중 한
개의 Contact Point 에서 Welding 이슈가 발생 했다
49. Havok_QualityType: Used to specify when to use
continuous physics. This does not affect fixed motion
type rigid bodies. The Default for this property is Auto
for Automatic Assignment by motion type.
Continuous vs Discrete
노란색 박스는 Quality Type을
Bullet 으로 설정했기 때문에
Continuous Physics 가 적용 된다
50. Havok Physics 패널
물리 시뮬레이션 활성화 버튼 과 물리
오브젝트의 종류별 디버그 모드 활성화 버튼
강체의 종류별로 충돌
처리 여부를 결정하기
위한 Collision Layer
설정 테이블
57. SWIG stands for Simplified Wrapper and Interface
Generator.
SWIG is an interface compiler that connects programs
written in C/C++ with a variety of high-level
programming languages such as Perl, Python, Ruby,
Lua…
SWIG is free software and an all-volunteer effort.
Good for:
• Rapid prototyping and testing.
• Systems integration.
• Construction of scripting language extension modules.
SWIG
58. Important Note!
Vision using SWIG to wrap C++ classes in Lua, so all
objects behave like pointers!
• Eg. Assignment ( vector1 = vector2 ) will modify the pointer and
not the data.
대안은?
• clone() method 활용 가능
• Eg. vector1 = vector2:clone()
Operators like '+', '-', '*', '/', etc. are safe because they
generate a new instance for you:
• Eg. vector1 = vector2 + vector3
SWIG
59. You can use a Lua script in Project Anarchy for…
• The whole game – GameScript
Present from initialization to de-initialization of the engine.
• The current scene – SceneScript
From scene initialization to de-initialization.
• GUI actions
Using callbacks like OnActive, OnClick, OnDoubleClick, …
• Any scene object by attaching the script component
Also using callbacks: OnCreate, OnSerialize, OnThink, …
• Accessing native Objects from Script
• Calling Script Functions from native Code
Lua Scripting
60. 템플릿 코드 삽입
Lua Scripting
템플릿 코드 삽입 버튼을 누르고
자주 사용되는 함수를 선택해서
쉽게 함수를 추가 할 수 있다
61. 자동 완성
self 와 같이 미리 정의된 기호에 .
또는 : 을 입력하면 해당 객체가
가지고 있는 함수들을 선택해서
입력할 수 있다
CTRL+SPACE 를 눌러서 수동으로
자동 완성 기능을 사용할 수도 있다.
그리고 ESC 키를 누르면 닫히게 된다.
62. Lua 도움말
도움말 버튼을 누르거나 단축키 F1 을
누르면 현재 선택한 스크립트에 해당되는
도움말이 자동으로 검색 된다
63. When you need to test the contents of a variable or just insert a
simple trace, printing to the screen can be a quick and simple
method of feedback. To do so use the command:
Debug:PrintLine("Hello World")
To join strings in the PrintLine method use the dot dot technique.
local numProps = self:GetNumProperties();
Debug:PrintLine("The entity has " .. numProps .. " prop(s)")
When you need to print the contents of a vector use the tostring(
var ) method.
Debug:PrintLine("Setting a new property value...")
self:SetProperty("myProp", Vision.hkvVec3(1.2, 2.3, 3.4));
propVal = self:GetProperty("myProp");
Debug:PrintLine("The entity's new property value is: " .. tostring(propVal))
Debug Printing
66. Block
Pickable.lua
• 폴리곤 단위로 오브젝트 픽킹이 가능하도록 설정
• 블록들의 마찰력과 탄성을 랜덤 하게 설정
Camera
PickUp.lua
• 마우스 , 터치 , RemoteInput Handling
• OnThink() – 오브젝트 픽킹 처리 및 Picking 된 Block을 X,Y 축으로
이동 , 삼각형 모양의 마우스 커서 그리기
Camera.lua
• OnAfterSceneLoaded()
◦ 화면의 좌,우 구석을 터치했을 경우 CameraPosition을 바라본 채로
화면 회전
BlockTower 스크립트 구성
67. 멀티 플랫폼을 위한 입력 처리
Eg. 다양한 종류의 입력 장치를 동시에 지원하기 위해
입력 이벤트를 Jump 라는 공통 이벤트로 추상화
입력 처리
Jump
CT_KB_SPACE CT_MOUSE_LEFT_BUTTON CT_TOUCH_DOUBLE_TAP CT_PAD_LEFT_TRIGGER
68. 터치 입력 or 가속도 값을 PC에서 동작중인 게임으로 전달
• HTML5 기반 Web-App
• 디바이스에 별도 설치 불필요
방향키 입력을 위한 가상 thumbsticks
Remote Input Tutorial
vRemoteInput
69. 카메라 회전 로직
화면 가장 자리를 터치 or 마우스 우클릭시 CameraEntity
를 중심으로 궤도를 돌며 회전 된다
Camera.lua
X = 0.15 X = 0.85
Y = 0.15
Y = 0.85
70. Pickup 로직
PickUp.lua
Start Point Moved Point
Moved Direction
Camera Position
Start Point
Moved Point
Moved
Direction
Camera
Perspective View
Top View