DYNAMICSDYNAMICSPart 2Part 2
HOW DOES IT WORK??HOW DOES IT WORK??byby
Willis LouieWillis LouieJianfei LiaoJianfei Liao
Arcade Game - 1942Arcade Game - 1942
Presentation MilestonePresentation Milestone Presentation 1 What is a Physics Presentation 1 What is a Physics
Engine?Engine? Presentation 2 How Does It Presentation 2 How Does It
Work?Work? Presentation 3 IntegrationPresentation 3 Integration Presentation 4 Testing and Presentation 4 Testing and
DocumentationDocumentation
TABLE OF CONTENTTABLE OF CONTENT 1) Implementation1) Implementation 2) Timeline / Current Status2) Timeline / Current Status 3) Concepts3) Concepts
ObjectsObjects JointsJoints CollisionCollision
TABLE OF CONTENTTABLE OF CONTENT 1) 1) ImplementationImplementation 2) Timeline / Current Status2) Timeline / Current Status 3) Concepts3) Concepts
ObjectsObjects JointsJoints CollisionCollision
Question:Question: How to implement the How to implement the physics?physics?
Answer: Answer: Physics simulationPhysics simulation
Simulation ProcessSimulation Process 1) Create a dynamic world1) Create a dynamic world
2) Create dynamics bodies2) Create dynamics bodies
3) Initializations3) Initializations
4) Step forward in the world4) Step forward in the world
TABLE OF CONTENTTABLE OF CONTENT 1) Implementation1) Implementation 2) 2) Timeline / Current StatusTimeline / Current Status 3) Concepts3) Concepts
ObjectsObjects JointsJoints CollisionCollision
Our TimelineOur Timeline
TABLE OF CONTENTTABLE OF CONTENT 1) Implementation1) Implementation 2) Timeline / Current Status2) Timeline / Current Status 3) 3) ConceptsConcepts
ObjectsObjects JointsJoints CollisionCollision
Applying PhysicsApplying Physics In order to apply physics we need to In order to apply physics we need to
know the object properties and know the object properties and attributesattributes
ObjectsObjects JointsJoints Collision Collision
TABLE OF CONTENTTABLE OF CONTENT 1) Implementation1) Implementation 2) Timeline / Current Status2) Timeline / Current Status 3) 3) ConceptsConcepts
ObjectsObjects JointsJoints CollisionCollision
Object PropertiesObject Properties position vector(x,y,z) – shape,sizeposition vector(x,y,z) – shape,size linear velocity(vx,vy,vz) – movementlinear velocity(vx,vy,vz) – movement Orientation – rotation,directionOrientation – rotation,direction Total body massTotal body mass Center of mass(and inertia matrix)Center of mass(and inertia matrix)
Object PropertiesObject Properties
Geometry objects + Rigid body = simulated Geometry objects + Rigid body = simulated objectobjectShape, etc Shape, etc Mass, etc Mass, etc
TABLE OF CONTENTTABLE OF CONTENT 1) Implementation1) Implementation 2) Timeline / Current Status2) Timeline / Current Status 3) 3) ConceptsConcepts
ObjectsObjects JointsJoints CollisionCollision
Joints, Joints, Joints!!!Joints, Joints, Joints!!! Joints (relationship between bodies) Joints (relationship between bodies)
Can move or turn a certain way onlyCan move or turn a certain way only Different joints (human vs. robot) Different joints (human vs. robot)
Ball, socket, universal joints, etcBall, socket, universal joints, etc Joints must connect, if not they fly offJoints must connect, if not they fly off Constraint force mixing for soft Constraint force mixing for soft
materialmaterial
TABLE OF CONTENTTABLE OF CONTENT 1) Implementation1) Implementation 2) Timeline / Current Status2) Timeline / Current Status 3) 3) ConceptsConcepts
ObjectsObjects JointsJoints CollisionCollision
CollisionCollision
CollisionCollision
Why must we have it?Why must we have it?
PING’S LAWPING’S LAW
Object A crashing into object B = Object A crashing into object B = EXPLOSIONEXPLOSION
EXPLOSION = EXCITEMENTEXPLOSION = EXCITEMENT
Collision DetectionCollision Detection collision detection enginecollision detection engine collision detection function – collision detection function –
touching or not?touching or not? Checks for contact points Checks for contact points Each contact point creates a contact Each contact point creates a contact
jointjoint To see what reaction should occur, To see what reaction should occur, Hard or soft, explode or bounce offHard or soft, explode or bounce off
Collision DetectionCollision Detection Each contact point creates a contact Each contact point creates a contact
jointjoint To see what reaction should occur, To see what reaction should occur, Hard or soft, explode or bounce offHard or soft, explode or bounce off
Collision DetectionCollision Detection LoopLoop
Apply forcesApply forces Adjust jointsAdjust joints Collision detectionCollision detection Create contact jointsCreate contact joints Carry out actionCarry out action Remove all contact jointsRemove all contact joints
So…How does it work?So…How does it work? Create the worldCreate the world Using attributes to simulate objectsUsing attributes to simulate objects Using joints to built complex objectsUsing joints to built complex objects Check the collision detectionCheck the collision detection Check the contact jointsCheck the contact joints If hit blow it upIf hit blow it up