1 / 32

Unity3D Physics

Unity3D Physics. April 3, 2015 Comp 150 - Game Design Michael Shah. Physics Topics. Physics Games Couple studies of physics gone well Physics as the main mechanic Case study of games Unity3D Physics Tweaking Physics Physics Engines Further items to look at (and appreciate physics).

randys
Download Presentation

Unity3D Physics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unity3D Physics April 3, 2015 Comp 150 - Game Design Michael Shah

  2. Physics Topics • Physics Games • Couple studies of physics gone well • Physics as the main mechanic • Case study of games • Unity3D Physics • Tweaking Physics • Physics Engines • Further items to look at (and appreciate physics)

  3. Realistic Physics • Goal is to simulate the real world as close as possible.

  4. Realism on a sliding Scale • Trials HD • Tony Hawk Pro Skater

  5. Cartoon Physics • Angry Birds • Flappy Bird • Mario

  6. Another reason to Love Unity

  7. Physics as A Mechanic • Half-Life 2 Gravity Gun • Portal

  8. Why we need good Physics https://youtu.be/NYt3B9lcUm0?t=4m49s (This game was probably never tested!)

  9. Unity Physics - The Basics • Built on top of Nvidia’s PhysX System • Lets look at the built in components

  10. Colliders • Box, Sphere, Capsule, and Mesh • OnCollisionEnter, OnCollisionExit, OnCollisionStay • Colliders as Triggers • OnTriggerEnter, OnTriggerExit, OnTriggerStay • Detecting a Collision requires at least one of the colliding objects to have a: void OnCollisionEnter(Collider col) method.

  11. Mesh Collider Example

  12. Mesh Collider Example

  13. Rigid Body • Used for moving objects • Gameobject is effected by Gravity

  14. Force and Torque • Add Force • Change movement of object • Add Torque • Rotate object around axis.

  15. Physic Materials • Physics Materials effect the way the object reacts in the game engine (Basketball versus bowling bowls surface). • Dynamic friction: Effects the object as it moves. • Static Friction: How much force is needed to move an object from a static position (sticky glue-like). • Bounciness: self-explanatory • Friction and Bounce Combine: How to respond to another object during collision.

  16. Joints • Fixed • Does not move until break force exceeded • Spring • Hooke’s Law • Hinge • Doors

  17. Raycasting • Raycasting: The process of shooting an invisible ray from a point to a specified direction into any colliders. • Use Debug.DrawRay to see where you are casting a ray

  18. Raycast Against Specific GameObjects

  19. Puzzles • Some Exercises to walk through • How would you implement the scene? • What types of objects would you construct? • What does the hierarchy look like?

  20. Puzzle #1 - Destructible Wall https://www.youtube.com/watch?v=IjELu_Q01eQ

  21. Puzzle #2 - Wrecking Ball https://www.youtube.com/watch?v=oAWGs0kt_vM

  22. Puzzle #3 - Trampoline http://forum.unity3d.com/threads/trampoline-bouncy-spring-please-help.53181/

  23. Puzzle #4 - Pool of Water https://www.youtube.com/watch?v=mDtnT5fh7Ek

  24. Puzzle #5 - Ragdoll

  25. Puzzle #6 - Destructible Objects https://www.youtube.com/watch?v=IXlA3HSIDPg

  26. Puzzle #7 - Improve Performance of Complicated Geometry http://unity3d.com/learn/tutorials/modules/intermediate/physics/physics-best-practices

  27. Answer - Physics Manager

  28. Best Practices • Remember that 2D is different than 3D in Unity • All of those puzzles, the same features apply, but use the 2D components! • http://devmag.org.za/2012/07/12/50-tips-for-working-with-unity-best-practices/ • 9. Put your world floor at y = 0. This makes it easier to put objects on the floor, and treat the world as a 2D space (when appropriate) for game logic, AI, and physics.

  29. Physics in Regards to Lighting

  30. Physics in Regards to Animation • Integrate Maya into the pipeline • ‘Apply Root Motion’ powers animated objects based on animation • No need to move Transform or add Force

  31. Animation as an Agent-Based System • Flocking Behavior • Physics - Attract and Repel Objects • https://www.youtube.com/watch?v=EZEK1lXxFfA • Crowd Simulation • Particle System

  32. Appreciating the built-in Physics Three Books to build your own physics engine

More Related