Havok Xtra Training

Slides:



Advertisements
Similar presentations
AP Physics C Mechanics Review.
Advertisements

Angular Quantities Correspondence between linear and rotational quantities:
Rigid Body Dynamics Jim Van Verth
Rotational Equilibrium and Rotational Dynamics
Two-Dimensional Rotational Dynamics W09D2. Young and Freedman: 1
Rotational Motion Chapter Opener. Caption: You too can experience rapid rotation—if your stomach can take the high angular velocity and centripetal acceleration.
Force and Moment of Force Quiz
Vectors Engineering I Grayson HS. Vectors A scalar is a physical quantity that has only magnitude and no direction. – Length – Volume – Mass – Speed –
Rolling, Torque, and Angular Momentum Rolling: Translation and Rotation Friction and Rolling Yo-yo Torque: A Cross Product Angular Momentum Newton’s Second.
Rotational Equilibrium and Rotational Dynamics
Physics 201: Lecture 18, Pg 1 Lecture 18 Goals: Define and analyze torque Introduce the cross product Relate rotational dynamics to torque Discuss work.
Warm Up Ch. 9 & 10 1.What is the relationship between period and frequency? (define and include formulas) 2.If an object rotates at 0.5 Hz. What is the.
Torque and Rotational Equilibrium
Lecture 36, Page 1 Physics 2211 Spring 2005 © 2005 Dr. Bill Holm Physics 2211: Lecture 36 l Rotational Dynamics and Torque.
Rotational Motion - refers to motion of a body about a fixed axis of rotation wherein, the particles have the same instantaneous angular velocity.
Color Problem Have a black-box function that returns a bright color in 24-bit RGB Want a paler version of the output What to do?
UNC Chapel Hill S. Redon - M. C. Lin Rigid body dynamics II Solving the dynamics problems.
Chapter 10 Rotational Motion
Physics 106: Mechanics Lecture 06 Wenda Cao NJIT Physics Department.
Physics 106: Mechanics Lecture 05 Wenda Cao NJIT Physics Department.
Physics 111: Mechanics Lecture 11 Dale Gary NJIT Physics Department.
Computer graphics & visualization Rigid Body Simulation.
Halliday/Resnick/Walker Fundamentals of Physics 8th edition
Computer graphics & visualization Collision Detection – Narrow Phase.
Classical Mechanics Review 4: Units 1-19
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Physically Based Animation.
Motion © David Hoult Displacement is distance moved in a specified direction © David Hoult 2009.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Game Physics – Part IV Moving to 3D
Give the expression for the velocity of an object rolling down an incline without slipping in terms of h (height), M(mass), g, I (Moment of inertia) and.
ESS 303 – Biomechanics Linear Kinetics. Kinetics The study of the forces that act on or influence movement Force = Mass * Acceleration: F = M * a Force.
Spring Rigid Body Simulation. Spring Contents Unconstrained Collision Contact Resting Contact.
Torque Chap 8 Units: m N 2.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
AP Physics C: Mechanics Chapter 11
Mechanics Topic 2.3 Work, Energy and Power. Work A simple definition of work is the force multiplied by the distance moved However this does not take.
Reminders:  NO SI THURSDAY!! Exam Overview “Approximately 1/3 of the problems will stress understanding of the physics concepts, whereas the remainder.
Chapter 6.1 Notes Power. The time it takes to complete an activity is as important as the work required. Compare running up stairs to walking up stairs.
Chapter 17 PLANE MOTION OF RIGID BODIES: ENERGY AND MOMENTUM METHODS
Developing An Educational Rigid Body Dynamics Physics Engine By Neal Milstein.
2008 Physics 2111 Fundamentals of Physics Chapter 10 1 Fundamentals of Physics Chapter 10 Rotation 1.Translation & Rotation 2.Rotational Variables Angular.
Rotational Mechanics. Rotary Motion Rotation about internal axis (spinning) Rate of rotation can be constant or variable Use angular variables to describe.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Physics for Games Spring 2012.
8-1 Torque.
Chipmunk Physics Remember that we talked about this a bit when we did collision handlers for the space ship integration task (SpritesActionsPhysicsSound).
Spring Rigid Body Simulation. Spring Contents Unconstrained Collision Contact Resting Contact.
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Rick Parent - CIS682 Rigid Body Dynamics simulate basic physics of an object subject to forces Keyframing can be tedious - especially to get ‘realism’
Two-Dimensional Rotational Dynamics 8.01 W09D2 Young and Freedman: 1.10 (Vector Product), , 10.4, ;
Physics 207: Lecture 17, Pg 1 Lecture 17 (Catch up) Goals: Chapter 12 Chapter 12  Introduce and analyze torque  Understand the equilibrium dynamics of.
Dynamics. Motion with Regard to Mass Particle Dynamics Mass concentrated in point Newton’s Equation Governs Motion f = M x.
Fundamentals of Computer Animation Rigid Body Simulation (1)
Rigid Body: Rotational and Translational Motion; Rolling without Slipping 8.01 W11D1.
Advanced Computer Graphics Rigid Body Simulation
2D Simulation of Rigid Bodies
Lecture Rigid Body Dynamics.
Rotational Inertia and Torque
Rotation As you come in, please set clicker to channel 44 and then answer the following question (before the lecture starts). Quiz – You are building.
Rolling, Torque, and Angular Momentum
Lecture 17 Goals Relate and use angle, angular velocity & angular acceleration Identify vectors associated with angular motion Introduce Rotational Inertia.
Devil physics The baddest class on campus Pre-IB Physics
Manipulator Dynamics 2 Instructor: Jacob Rosen
Motion in Real and Virtual Worlds
11.7   Angular Momentum Figure shows a particle of mass m with linear momentum as it passes through point A in an xy plane. The angular.
Computer Animation Algorithms and Techniques
Rigid Body: Rotational and Translational Motion; Rolling without Slipping 8.01 W11D1 Today’s Reading Assignment Young and Freedman: 10.3.
Rigid Body: Rotational and Translational Motion; Rolling without Slipping 8.01 W11D1 Today’s Reading Assignment Young and Freedman:
GPAT – Chapter 7 Physics.
Presentation transcript:

Havok Xtra Training

Introduction Physics Simulation? Havok Xtra Workflow – Tutorials – Gotchas

Physics Simulation Initialize Step – Advance simulation by h seconds 10 Apply Forces 20 Do Collision Detection 30 Do Collision Resolution 40 Go to 10 Shutdown

Step real new position estimated new position r(t 0 + h) r(t 0 ) h v(t 0 )

Step Improve by: – decreasing step size – introducing sub steps Simulated position Actual position

Step Sub steps

Step Stepping strategy – Fixed havok.step( 1.0 / the tempo ) – + system can be optimized for the time step – - less control over simulation level of detail – Variable havok.step( newTime - oldTime ) – + real-time if linked to system clock – - can introduce escalating, large time steps – Hybrid

Havok Xtra Workflow Content Creation Setup Control W3D Files HKE Files

Content Creation Shockwave 3D members – Rigid bodies must link to a visual equivalent – Geometry Lingo Exported from a modeling package – W3D – HKE

Geometry Implicit – Plane – Sphere Convex – Compound Concave Proxies

Representations Geometry

Proxies Representations – Physics – Display

max Havok Guidelines Supported – Rigid Bodies – Springs – Dashpots Unsupported – Deformable Bodies – Constraints – Display Information

max Havok Guidelines Compound Rigid Bodies – Groups should be open Rigid Body Collections – Check the integrator – Disable unnecessary collisions Proxy Geometry – Transforms must be aligned

max Havok Guidelines IntegratorCPUAccuracy Havok Xtra members use Euler Max Havok defaults to Runga Kutta Euler Low Back-Euler Medium Runga Kutta (RK45) High Midpoint MediumMedium-High

Setup Initialize – Blank HKE Scale Tolerance – Imported HKE

Setup Initialize – How is the simulation displayed? Physics objects must link to a visual equivalent – What is the mapping between the physics simulation and its display?

Scale Size matters – Physics units are meters, seconds and kilograms – Display unit may be different havok.initialize(member, tolerance, worldScale) – Examples: havok.initialize(1, 0.1, 1.0) -- meters havok.initialize(1, 4, ) -- inches havok.initialize(1, 10, 1000) -- kilometers

Box falls in: – ~1 second if units are meters – ~40 seconds if units are in kilometers Scale

Setup Initialize property hk, s on beginSprite me hk = member("HKE") s = member("W3D") hk.initialize( s ) end on exitFrame me hk.step() end on endSprite me hk.shutdown() s.resetWorld() end

Setup Rigid Body s = member(“W3D") hk = member(“HKE") mr = s.newModelResource(“MDLRes", #box) m = s.newModel(“MDL") m.addModifier(#meshdeform) if bWantFixed then rb = hk.makeMovableRigidBody(m.name, 10.0) else rb = hk.makeFixedRigidBody(m.name) end if

Control Input – Properties – Functions – Behaviors Step call backs Output – Properties – Collision Details Collision call backs

Control Collision Callback: Called when a certain pair of objects collide. Information about the collision is returned to the user here so that they may take appropriate action. Collision Callback: Called when a certain pair of objects collide. Information about the collision is returned to the user here so that they may take appropriate action. Setup Initial Conditions: Define Geometry Initial position and velocity, gravity, wind, air resistance, Time step = h = 1/60 seconds Setup Initial Conditions: Define Geometry Initial position and velocity, gravity, wind, air resistance, Time step = h = 1/60 seconds Update System: Advance time to t = t + h: Integrate Calculate new position & orientation Advance time to t = t + h: Integrate Calculate new position & orientation Call LINGO: LINGO specific updates applied. Call LINGO: LINGO specific updates applied. Detect Collision: Determine all colliding objects. Use physics parameters to Determine appropriate response Detect Collision: Determine all colliding objects. Use physics parameters to Determine appropriate response Display: Draw object at specified new location. Display: Draw object at specified new location. Update State: Calculate forces, velocity, acceleration... Update State: Calculate forces, velocity, acceleration...

Control Global Control – Time Step – Gravity – Deactivation Parameters – Drag Parameters Local Control – Rigid Bodies

Rigid Bodies Vectors: – position (m) – velocity (m/s) – angular velocity (rad/s) – momentum (kg m/s) – angular momentum (kg rad/s) – force (kg m/s 2 = N) – torque (kg m 2 /s 2 = Nm ) – acceleration (m/s 2 ) – angular acceleration (rad/m 2 ) Scalars: – mass (kg) – friction – restitution Use right hand rule for angular quantities: +ve  CCW rotation -ve  CW rotation

Rigid Bodies applyForce No immediate change in velocity applyImpulse Immediate change in velocity

Rigid Bodies Alter position: – rb.position = vector(2.0, 3.0, 4.0) Alter velocity: – rb.linearVelocity = vector(1.0, 0.0, 0.0) – rb.applyImpulse(vector(1.0, 0.0, 0.0)) – rb.applyImpulseAtPoint(impulse, point) Alter acceleration: – rb.applyForce(vector(1.0, 0.0, 0.0)) – rb.applyForceAtPoint(force, point) ! DANGER ! induces spin force applied at center of mass

Rigid Bodies Alter orientation: – body.rotation = [vector(0.0, 1.0, 0.0), 90] Alter angular velocity: – body.angularVelocity = vector(1.0, 0.0, 0.0) – body.applyAngularImpulse(vector(2.0, 0.0, 0.0)) Alter angular acceleration: – body.applyTorque(vector(2.0, 0.0, 0.0)) ! DANGER ! Axis = (1.0, 0.0, 0.0) Magnitude = 2.0

Rigid Bodies Problem with direct manipulation Interpenetrations = not good set position set orientation ! DANGER !

Rigid Bodies attemptMoveTo(pos, axis, angle) – moves object to position & orientation and checks for interpenetration – returns true if successful – returns false if move illegal and put back interpolatingMoveTo(pos, axis, angle) – positions object as close to desired location as possible – returns parametric distance – 1.0 if moved completely – 0.5 if moved halfway – 0.0 if not moved at all desired new position interpolatingMoveTo gets 70% there

Behaviors Apply Constant Acceleration on enterFrame me rb = hk.rigidBody( pModel ) if not voidP( rb ) then rb.applyForce( acc * rb.mass ) end if end enterFrame Anti-gravity behavior if force is negation of havok.gravity? rb.applyForce( acc * rb.mass * pHavok.substeps )

Behaviors Step callbacks – Anti-gravity on beginSprite me hk.registerStepCallback(#antigrav,me) end beginSprite on antiGrav me, newTime acc = -hk.gravity rb = hk.rigidBody( pModel ) if not voidP( rb ) then rb.applyForce( acc * rb.mass ) end if end antiGrav

Collision Detection Back-stepping Time t Time t+h Region of interpenetration

Collision Detection Tolerance – Physical simulations have a limited resolution – Tolerance accounts for numerical inaccuracies LOW  numerically instable HIGH  noticeable gaps between objects: – Rule of thumb: tolerance = world scale / 10.0 tolerance

Collision Detection Call me after a collision hk.registerInterest( rb1, #all, f, t, #handler, me ) Callback passed collision details on handler( me, details ) put details end Lost Interest hk.removeInterest( rb.name )

Collision Detection Details – Name of Rigid Body A – Name of Rigid Body B – Contact Point – Contact Normal – Normal Relative Velocity A B

Collision Detection Not all collisions are needed hk.disableCollision( rb1, rb2 ) Might not need any hk.disableAllCollision( rb1 ) Or maybe some hk.enableCollision( rb.name, “Ground” )

Gotchas Initialize:only ever one simulation activate Initialize:what the scaling