SlideShare a Scribd company logo
1 of 70
Download to read offline
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.1
Havok Physics Primer
Field Application Engineer
Alex Kang
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.5
아이작 뉴턴
(1643~1727)
운동의 제1법칙 ( 관성의 법칙)
운동의 제2법칙 (가속도의 법칙)
운동의 제3법칙 (작용 반작용의 법칙)
만유인력의 법칙[1687, Principia]
Physics - Dynamics
뉴턴 역학 (Newtonian Mechanics)
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.6
Physics Engine
강체 (Rigid Body) 시뮬레이션
동역학 (Dynamics) 시뮬레이션
물리적인 속성들 (Physical Properties)
충돌 처리 (Collision Detection)
Constraint Systems
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.7
Rigid Body Simulation
Rigid Body, 절대로 형태가 변하지 않는 단단한
물체
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.8
Rigid Body Simulation
지형(Landscape)은 변하지 않음
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.9
Rigid Body Simulation
단순화된 Collision geometry(Shape) 을 사용
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.10
Rigid Body Simulation
속도를 위해 물리 연산이 비활성화 되기도 함
(Simulation Island)
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.11
Dynamics Simulation
연속적인 이동 경로를 일정한 시간 주기로
나누어서 Collision detection 계산
Continuous Discrete
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.13
Dynamics Simulation
Iterations (sub-time-steps)
– physics simulation은 화면 갱신 주기보다 자주 발생됨
– sub-steps 는 조절 가능
Accumulation of error
– 다음 step 계산시 바로 직전
Step 만을 참조 한다.
(= Full history 가 아님)
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.14
Physical Properties
질량 (Mass)
– 물체를 움직이게 하는데 필요한 힘의 크기
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.15
Physical Properties
정지 마찰계수 (Static friction)
– 정지된 상태의 물체가 미끌어지지 않도록 막는 힘
– 물체가 안정적으로 붙어 있게 해주는 주요 속성
운동 마찰계수 (Dynamic friction)
– 바닥에 붙은채 움직이는 물체에 작용하는 마찰 계수
[Friction Demo]
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.16
Physical Properties
반발계수,복원력 (Restitution)
– 충돌이 발생된 후 보존되는 에너지의 양
– 0 ~ 1.98 사이의 값으로 입력 가능
Restitution 을 1.98로 설정한 경우
충돌 후에도 힘을 거의 상실하지 않는다
Restitution 을 0로 설정하면
충돌 직후 힘을 모두 상실하면서 멈추게 된다.
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.17
Physical Properties
Center of mass (COM)
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.18
Inertia Tensor
– 회전 속도의 변화에 대한 저항값
Physical Properties
Inertia Tensor Scaling 을 0.001 로
낮은 값으로 지정 하면 충돌로 이후
더욱 빠르게 회전한다
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.19
Collision Detection
물리 엔진의 핵심 코어
최적화를 위해 여러 단계를 거쳐서 처리
– Broadphase:
더 상세한 충돌 처리 단계로 넘어가기전 AABB 를 사용
해서 대부분의 오브젝트를 제거하는 과정
– Midphase:
충돌 처리를 위한 연산의 복잡도를 낮추는 과정
– Narrowphase:
실제 오브젝트 간의 Distance 계산이 이루어짐
Narrowphase 에서의 오브젝트 쌍의 개수에 의해
Performance가 결정됨
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.20
Collision Detection
Broadphase
간단한 AABB 연산
을 통해 가능한 많은
오브젝트를 제거함
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.21
Collision Detection
Midphase
복잡한 오브젝트를 나누기 위해 BroadPhase에 비해
무거운 연산이 필요하게됨
– Example
Landscape 전체가 아닌
통나무와 충돌 가능성이
있는 일부 삼각형 만을 선별
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.22
Collision Detection
Narrowphase
최종 충돌 여부를 판정하기 위해 거리 계산을 수행
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.23
Collision Detection
Rigid bodies and collision geometries(Shape)
– 빠른 충돌 연산을 위해 적절한 Shape을 사용해야 한다
Triangle
Capsule
Cylinder
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.25
Collision Detection
Convex hull shapes
그래픽 메쉬를 감싸는 “shrink wrap” Shape
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.29
Collision Detection
Compound shapes
– convex list shapes 의 충돌 처리를 빠르게 하기 위해
추가적인 midphase 사용
– 계층적인 트리 구조
– Sub-object의 Instances 으로 메모리 절약 가능
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.30
Collision Detection
Discrete Collision Detection의 한계
– Missed collisions
"bullet-through-paper„
– Interpenetration
오브젝트가 파묻힘
[Discrete vs Continuous Demo]
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.31
Collision Detection
Discrete
Continuous
Integrate Collide
Penetration
acceptable.
=> Done.
Integrate Collide
Detect Penetration
Generate TOI
Solve TOI
Collision
Re-Integrate
Re-Collide
t0 t1
t0 t1
No TOIs
=> Done.
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.32
짧은 시간안에 너무 많은 TOI가
반복되는 경우
Worst Case 에서 안정적인 퍼포먼스
와 표현의 정확도를 유지
[SqueezedBall Demo]
[Priority Demo]
Robust Continuous Physics
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.33
Robustness in Worst Cases
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.37
Constraint Systems
연결된 Rigid body 에서의 Constraint systems
– Springs
– Dashpots
– Gears
– Mechanical joints
– Limited motion
– Motorized motion
Ball and Socket Constraint
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.40
Constraint Systems
다양하게 연결된 Constraint System 사례
[ArmConveyor Demo]
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.41
Ragdoll
다이내믹한 Death 애니메이션 연출
Ragdoll on Stairs Demo
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.43
안정적이면서도 빠른 충돌 처리
– Continuous Physics
– Constraint System
– Multi Thread 최적화
편리한 워크 플로우
– Visual Debugger
– 3ds Max, Maya, Softimage 플러그인
다양한 부가 기능
– Character Controllers
– Ragdoll
– Vehicle kit
Havok Physics?
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.47
Character Controller
Character Controller
– State Machine
– Rigid Body or Proxy Version
– Fast Simplex Solver
[Character Proxy Demo] [Character Rigid Body Moving Demo]
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.49
Vehicle Kit
Vehicle SDK
– 게임에 바로 적용이 가능한 차량 시뮬레이션
– 오토바이, 4륜 차량, 트럭, 기차 ..등
– 차량의 물리적인 특성을 조절 가능
Vehicles Comparison 데모
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.50
Visual Debugger
물리 디버그 도구 Visual Debugger
– 네트워크로 연결을 사용한 원격 디버깅
– 장면의 물리적인 상태를 Recording / playback
– 원격 프로파일링 지원
[game client runtime] [Visual Debugger]
Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.51
Thank you
Find out more at www.havok.com
http://cafe.naver.com/visionengine
http://www.facebook.com/HavokKorea
http://www.youtube.com/user/HavokEnthusiast
http://www.youtube.com/user/havokchannel
http://software.intel.com/en-us/forums/havok
HavokRigidBodyComponent
Havok Rigid Body 컴포넌트
엔터티에 Havok Rigid Body
컴포넌트를 추가하면 물리를 적용할 수
있다
 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로 설정하면
충돌 직후 힘을 모두 상실하면서 멈추게 된다.
 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 으로 설정하면 마찰력이 없어서
빠르게 미끄러 진다
 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
 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 로 지정
하면 마찰력이 없는 상태에서도
속도가 빠르게 줄어든다
 Angular Damping: Defines how strong the
rotation of this Rigid Body is reduced over time.
 입력 범위: 0 ~ 1
Angular Damping
Angular Damping을 1 로 지정
하면 회전 속도가 빠르게 줄어든다
ShapeType
Box Sphere Convex Hull
Capsule Cylinder Mesh File
Convex Hull
Convex Hull
 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 로
낮은 값으로 지정 하면 충돌로 이후
더욱 빠르게 회전한다
 Welding is used to reduce the
Problem of objects bouncing
 Vision is usually using Anti-
Clockwise
Welding Type
바닥면의 WeldingType 을 None 으로
설정한 상태에서는 바닥 폴리곤의
경계부분 에서 공의 방향이 엉뚱한
곳으로 튀는 현상이 종종 발생 된다
Welding 이슈 사례
박스 형태의 강체가 지면과 맞닿은 상태에서 이웃하는
폴리곤으로 이동 하던 중 4개의 Contact Point 중 한
개의 Contact Point 에서 Welding 이슈가 발생 했다
Center of Mass
Center of Mass 설정 위치
Center of Mass 가 설정된 부분이
아래로 향하게 된다
 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 가 적용 된다
Havok Physics 패널
물리 시뮬레이션 활성화 버튼 과 물리
오브젝트의 종류별 디버그 모드 활성화 버튼
강체의 종류별로 충돌
처리 여부를 결정하기
위한 Collision Layer
설정 테이블
Project Anarchy 엔진으로
Block Tower 게임 만들기
 {VisionSDK}DataVisionSamplesEngineBlockTower
 C++ 구현 없이 Lua 스크립트 만으로 개발된 게임 샘플
 게임 개발 경험이 없더라도 몇 시간 안에 제작이 가능
 Havok™ Physics 의 물리 시뮬레이션을 활용
 Block Tower tutorial video
Block Tower
 Grid , Snap Position 활성화
타일 편집 방식
 블록들의 초기 물리 상태 안정화 하기
• 물리 시뮬레이션 결과를 블록의 초기 위치로 저장
블록 쌓기
 Table (EntityShape)
• Havok Rigid Body Component
 Block (EntityShape)
• Havok Rigid Body Component
• Lua Script Component - Pickable.lua
 CameraPosition (CameraPositionShape)
 Camera (EntityShape)
• Look at target 으로 사용됨
• Orbit Camera Component
• Lua Script Component - PickUp.lua
• Lua Script Component - Camera.lua
 SunLight (DynLightShape)
• Mobile Shadow Map Component
Block Tower 장면 구성 요소
프로젝트 아나키
Lua Scripting 소개
 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
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
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
 템플릿 코드 삽입
Lua Scripting
템플릿 코드 삽입 버튼을 누르고
자주 사용되는 함수를 선택해서
쉽게 함수를 추가 할 수 있다
자동 완성
self 와 같이 미리 정의된 기호에 .
또는 : 을 입력하면 해당 객체가
가지고 있는 함수들을 선택해서
입력할 수 있다
CTRL+SPACE 를 눌러서 수동으로
자동 완성 기능을 사용할 수도 있다.
그리고 ESC 키를 누르면 닫히게 된다.
Lua 도움말
도움말 버튼을 누르거나 단축키 F1 을
누르면 현재 선택한 스크립트에 해당되는
도움말이 자동으로 검색 된다
 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
 vRSD 를 이용한 Lua 스크립트 디버깅
Lua 스크립트 디버깅
BlockTower 샘플
Lua Script 분석
Block
 Pickable.lua
• 폴리곤 단위로 오브젝트 픽킹이 가능하도록 설정
• 블록들의 마찰력과 탄성을 랜덤 하게 설정
Camera
 PickUp.lua
• 마우스 , 터치 , RemoteInput Handling
• OnThink() – 오브젝트 픽킹 처리 및 Picking 된 Block을 X,Y 축으로
이동 , 삼각형 모양의 마우스 커서 그리기
 Camera.lua
• OnAfterSceneLoaded()
◦ 화면의 좌,우 구석을 터치했을 경우 CameraPosition을 바라본 채로
화면 회전
BlockTower 스크립트 구성
멀티 플랫폼을 위한 입력 처리
 Eg. 다양한 종류의 입력 장치를 동시에 지원하기 위해
입력 이벤트를 Jump 라는 공통 이벤트로 추상화
입력 처리
Jump
CT_KB_SPACE CT_MOUSE_LEFT_BUTTON CT_TOUCH_DOUBLE_TAP CT_PAD_LEFT_TRIGGER
 터치 입력 or 가속도 값을 PC에서 동작중인 게임으로 전달
• HTML5 기반 Web-App
• 디바이스에 별도 설치 불필요
 방향키 입력을 위한 가상 thumbsticks
 Remote Input Tutorial
vRemoteInput
카메라 회전 로직
 화면 가장 자리를 터치 or 마우스 우클릭시 CameraEntity
를 중심으로 궤도를 돌며 회전 된다
Camera.lua
X = 0.15 X = 0.85
Y = 0.15
Y = 0.85
Pickup 로직
PickUp.lua
Start Point Moved Point
Moved Direction
Camera Position
Start Point
Moved Point
Moved
Direction
Camera
Perspective View
Top View

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

숭실대 프로젝트 아나키 워크샵 part2

  • 1. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.1 Havok Physics Primer Field Application Engineer Alex Kang
  • 2. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.5 아이작 뉴턴 (1643~1727) 운동의 제1법칙 ( 관성의 법칙) 운동의 제2법칙 (가속도의 법칙) 운동의 제3법칙 (작용 반작용의 법칙) 만유인력의 법칙[1687, Principia] Physics - Dynamics 뉴턴 역학 (Newtonian Mechanics)
  • 3. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.6 Physics Engine 강체 (Rigid Body) 시뮬레이션 동역학 (Dynamics) 시뮬레이션 물리적인 속성들 (Physical Properties) 충돌 처리 (Collision Detection) Constraint Systems
  • 4. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.7 Rigid Body Simulation Rigid Body, 절대로 형태가 변하지 않는 단단한 물체
  • 5. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.8 Rigid Body Simulation 지형(Landscape)은 변하지 않음
  • 6. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.9 Rigid Body Simulation 단순화된 Collision geometry(Shape) 을 사용
  • 7. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.10 Rigid Body Simulation 속도를 위해 물리 연산이 비활성화 되기도 함 (Simulation Island)
  • 8. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.11 Dynamics Simulation 연속적인 이동 경로를 일정한 시간 주기로 나누어서 Collision detection 계산 Continuous Discrete
  • 9. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.13 Dynamics Simulation Iterations (sub-time-steps) – physics simulation은 화면 갱신 주기보다 자주 발생됨 – sub-steps 는 조절 가능 Accumulation of error – 다음 step 계산시 바로 직전 Step 만을 참조 한다. (= Full history 가 아님)
  • 10. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.14 Physical Properties 질량 (Mass) – 물체를 움직이게 하는데 필요한 힘의 크기
  • 11. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.15 Physical Properties 정지 마찰계수 (Static friction) – 정지된 상태의 물체가 미끌어지지 않도록 막는 힘 – 물체가 안정적으로 붙어 있게 해주는 주요 속성 운동 마찰계수 (Dynamic friction) – 바닥에 붙은채 움직이는 물체에 작용하는 마찰 계수 [Friction Demo]
  • 12. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.16 Physical Properties 반발계수,복원력 (Restitution) – 충돌이 발생된 후 보존되는 에너지의 양 – 0 ~ 1.98 사이의 값으로 입력 가능 Restitution 을 1.98로 설정한 경우 충돌 후에도 힘을 거의 상실하지 않는다 Restitution 을 0로 설정하면 충돌 직후 힘을 모두 상실하면서 멈추게 된다.
  • 13. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.17 Physical Properties Center of mass (COM)
  • 14. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.18 Inertia Tensor – 회전 속도의 변화에 대한 저항값 Physical Properties Inertia Tensor Scaling 을 0.001 로 낮은 값으로 지정 하면 충돌로 이후 더욱 빠르게 회전한다
  • 15. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.19 Collision Detection 물리 엔진의 핵심 코어 최적화를 위해 여러 단계를 거쳐서 처리 – Broadphase: 더 상세한 충돌 처리 단계로 넘어가기전 AABB 를 사용 해서 대부분의 오브젝트를 제거하는 과정 – Midphase: 충돌 처리를 위한 연산의 복잡도를 낮추는 과정 – Narrowphase: 실제 오브젝트 간의 Distance 계산이 이루어짐 Narrowphase 에서의 오브젝트 쌍의 개수에 의해 Performance가 결정됨
  • 16. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.20 Collision Detection Broadphase 간단한 AABB 연산 을 통해 가능한 많은 오브젝트를 제거함
  • 17. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.21 Collision Detection Midphase 복잡한 오브젝트를 나누기 위해 BroadPhase에 비해 무거운 연산이 필요하게됨 – Example Landscape 전체가 아닌 통나무와 충돌 가능성이 있는 일부 삼각형 만을 선별
  • 18. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.22 Collision Detection Narrowphase 최종 충돌 여부를 판정하기 위해 거리 계산을 수행
  • 19. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.23 Collision Detection Rigid bodies and collision geometries(Shape) – 빠른 충돌 연산을 위해 적절한 Shape을 사용해야 한다 Triangle Capsule Cylinder
  • 20. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.25 Collision Detection Convex hull shapes 그래픽 메쉬를 감싸는 “shrink wrap” Shape
  • 21. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.29 Collision Detection Compound shapes – convex list shapes 의 충돌 처리를 빠르게 하기 위해 추가적인 midphase 사용 – 계층적인 트리 구조 – Sub-object의 Instances 으로 메모리 절약 가능
  • 22. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.30 Collision Detection Discrete Collision Detection의 한계 – Missed collisions "bullet-through-paper„ – Interpenetration 오브젝트가 파묻힘 [Discrete vs Continuous Demo]
  • 23. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.31 Collision Detection Discrete Continuous Integrate Collide Penetration acceptable. => Done. Integrate Collide Detect Penetration Generate TOI Solve TOI Collision Re-Integrate Re-Collide t0 t1 t0 t1 No TOIs => Done.
  • 24. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.32 짧은 시간안에 너무 많은 TOI가 반복되는 경우 Worst Case 에서 안정적인 퍼포먼스 와 표현의 정확도를 유지 [SqueezedBall Demo] [Priority Demo] Robust Continuous Physics
  • 25. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.33 Robustness in Worst Cases
  • 26. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.37 Constraint Systems 연결된 Rigid body 에서의 Constraint systems – Springs – Dashpots – Gears – Mechanical joints – Limited motion – Motorized motion Ball and Socket Constraint
  • 27. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.40 Constraint Systems 다양하게 연결된 Constraint System 사례 [ArmConveyor Demo]
  • 28. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.41 Ragdoll 다이내믹한 Death 애니메이션 연출 Ragdoll on Stairs Demo
  • 29. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.43 안정적이면서도 빠른 충돌 처리 – Continuous Physics – Constraint System – Multi Thread 최적화 편리한 워크 플로우 – Visual Debugger – 3ds Max, Maya, Softimage 플러그인 다양한 부가 기능 – Character Controllers – Ragdoll – Vehicle kit Havok Physics?
  • 30. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.47 Character Controller Character Controller – State Machine – Rigid Body or Proxy Version – Fast Simplex Solver [Character Proxy Demo] [Character Rigid Body Moving Demo]
  • 31. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.49 Vehicle Kit Vehicle SDK – 게임에 바로 적용이 가능한 차량 시뮬레이션 – 오토바이, 4륜 차량, 트럭, 기차 ..등 – 차량의 물리적인 특성을 조절 가능 Vehicles Comparison 데모
  • 32. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.50 Visual Debugger 물리 디버그 도구 Visual Debugger – 네트워크로 연결을 사용한 원격 디버깅 – 장면의 물리적인 상태를 Recording / playback – 원격 프로파일링 지원 [game client runtime] [Visual Debugger]
  • 33. Havok Confidential. © Copyright 2012 Havok.com (or its licensors). All Rights Reserved. Confidential Information of Havok.51 Thank you Find out more at www.havok.com http://cafe.naver.com/visionengine http://www.facebook.com/HavokKorea http://www.youtube.com/user/HavokEnthusiast http://www.youtube.com/user/havokchannel http://software.intel.com/en-us/forums/havok
  • 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 로 지정 하면 회전 속도가 빠르게 줄어든다
  • 41. ShapeType Box Sphere Convex Hull Capsule Cylinder Mesh File
  • 42.
  • 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 이슈가 발생 했다
  • 48. Center of Mass Center of Mass 설정 위치 Center of Mass 가 설정된 부분이 아래로 향하게 된다
  • 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 설정 테이블
  • 51. Project Anarchy 엔진으로 Block Tower 게임 만들기
  • 52.  {VisionSDK}DataVisionSamplesEngineBlockTower  C++ 구현 없이 Lua 스크립트 만으로 개발된 게임 샘플  게임 개발 경험이 없더라도 몇 시간 안에 제작이 가능  Havok™ Physics 의 물리 시뮬레이션을 활용  Block Tower tutorial video Block Tower
  • 53.  Grid , Snap Position 활성화 타일 편집 방식
  • 54.  블록들의 초기 물리 상태 안정화 하기 • 물리 시뮬레이션 결과를 블록의 초기 위치로 저장 블록 쌓기
  • 55.  Table (EntityShape) • Havok Rigid Body Component  Block (EntityShape) • Havok Rigid Body Component • Lua Script Component - Pickable.lua  CameraPosition (CameraPositionShape)  Camera (EntityShape) • Look at target 으로 사용됨 • Orbit Camera Component • Lua Script Component - PickUp.lua • Lua Script Component - Camera.lua  SunLight (DynLightShape) • Mobile Shadow Map Component Block Tower 장면 구성 요소
  • 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
  • 64.  vRSD 를 이용한 Lua 스크립트 디버깅 Lua 스크립트 디버깅
  • 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