Chapter 11.0 Physics, PhysX, and PhAT

Real Time physics or game physics involves the introduction of the laws of physics into a simulation or game engine for the purpose of making the effects appear more real to the observer. Typically, simulation physics is only a close approximation to real physics, and computation is performed using discrete values.

There are several elements that form components of simulation physics:
  • Physics engine is program code that is used to simulate Newtonian physics within the environment.
  • Collision detection is used to solve the problem of determining when any two or more physical objects in the environment cross each other's path.
Unreal Engine 3 uses the PhysX physics engine to drive its physical simulation calculations. PhysX provides the ability to perform accurate collision detection as well as simulate physical interactions between objects within the world. Having physics in your game will help improve the immersion value of every scene, as it helps players believe that they are interacting with the scene and that the scene is responding back in some way or another.

PhysX cloth allows you to simulate long flowing capes for your heroes or long, tearable flags. Using PhysX soft bodies, you can simulate flexible bodies that bend and twist as the player prods it. It is also possible to create physically interactive fog, or other complex physical particle simulations. And all this, in real time.
http://udn.epicgames.com/Three/PhysicsHome.html

Collision Reference
As well as making your Unreal level look amazing, it is worth spending some time on the collision for objects in your level. There are two types of collision performed: Unreal collision and physics collision for rigid bodies (based the Novodex PhysX).

Collision with the level BSP and terrain should work fine without much tweaking. Collision with static meshes, however, can require some optimization, simply because of the large number of triangles involved. The main job here is using simpler shapes for collision than for graphics. There are 2 reasons for doing this:

  • Faster. With the number of triangles now in a level, using just the graphics triangles for collision can get really slow.
  • Smoother. It can be really annoying to get snagged on some small graphical detail in the middle of a fire
http://udn.epicgames.com/Three/CollisionReference.html

PhysX Reference 
A reference over viewing the PhysX integration with Unreal Engine 3. 

PhysX Constraints Reference
A constraint is basically another name for a joint. It allows you to connect two rigid bodies together, and also apply limits or forces. Unreal Engine 3 has a very flexible and data-driven constraint system that allows designers to make many different types of joint simple by changing some options. The engine has a few default joint types (ball-and-socket, hinge, prismatic) but they only differ in their settings. You should feel free to start with any joint type and experiment with making your own configurations. 

Damping and Friction 
There are three main settings that can be used to slow down objects in a physical world - joint drive, damping in the PhysicalMaterial and RigidBodyDamping in the PhysicsVolume. 


APEX Framework
APEX is a framework developed by NVIDIA that provides both tools for content creation and run-time libraries that allow artists and developers to create complex physical simulations more easily. The Unreal Engine 3 integration of APEX includes realistic cloth which can be used for simulating flags, banners, curtains, or clothing for characters. In addition, the APEX integration includes the ability to simulate destruction of physical objects for the creation of destructible environments.
http://udn.epicgames.com/Three/APEXOverview.html


Physics Asset Tool ( Phat ) User Guide
The Unreal Physics Editor - PhAT (Physics Asset Tool) - is an integrated tool in the Unreal Editor designed specifically to manipulate physical setups for skeletal objects.
http://udn.epicgames.com/Three/PhATUserGuide.html

Physical Materials 
Physics materials are fairly easy to use. Creating one will give you a set of default values, identical to the default physical material that is applied to all physics objects. Physical materials are used to define the response of a physical object when interacting dynamically with the world. Examples of this would be a character's dead body (ragdoll), a movable crate, etc. Physical material masks provide the ability to use two physical materials on different parts of a graphical material.
http://udn.epicgames.com/Three/PhysicalMaterial.html

Physical Material Masks
A physical material mask provides the ability to use two physical materials on different parts of a graphical material. A physical material mask can be used to create unique effects on a static mesh without the need for multiple elements and materials. A simple example is a window mesh that has a material which is partly wood (for a window frame) and partly glass (for a window). You can set up a physical material mask to play a glass breaking sound when the glass part of the material is hit, and a wood cracking sound when the wood part of the material is hit. 
http://udn.epicgames.com/Three/PhysicalMaterialMask.html


Animation and PhysX
There are often situations where physics simulations must be performed on attachments to achieve the desired animation. For example, chains on a prisoner that rattle around or rag dolls for an unconscious character that flops around. As the characters moves and blends between different animations, it's impossible to predetermine where things may be. Unreal Engine 3 solves this problem by allowing animators and programmers to define some or all bones in a skeletal mesh as physically simulated rigid body attachments.
A character that has chains attached to the arms that are driven by physics, with the rest of the body driven by blended animations and inverse kinematics.
http://udn.epicgames.com/Three/PhysicalAnimation.html


PhysX Soft Body Reference
 Soft-bodies in UE3 are available as an optional extension to skeletal-meshes, similar to cloth and metal-cloth. Their usage in the editor - i.e., how soft-body meshes are imported, edited and placed into levels - also closely mirrors the handling of cloth assets. Before reading on, please make sure you’re familiar with at least the basics of how to use cloth, as this tutorial will primarily highlight the soft-body specific details and just quickly skim over the basic concepts shared with cloth.
http://udn.epicgames.com/Three/PhysXSoftBodyReference.html


PhysX Cloth Reference
Cloth simulation in Unreal Engine 3 is handled by PhysX's cloth simulation engine. With this technique you are able to create interactive decorations such as curtains and flags. Because cloth may receive collision events, they can be affected by players, their weapons and other movement based events.
http://udn.epicgames.com/Three/PhysXClothReference.html

PhysX Particle System Reference

The PhysXParticleSystem is a container for PhysX fluid parameters. This set of parameters is organized for better clarity in the editor. The PhysXParticleSystem may be shared by many emitters, which allows you to easily re-use your tuning of the physical aspects of the particle simulation. The PhysXParticleSystem provides particle movement and collision with the PhysX scene. Additionally, it can be configured to perform SPH fluid simulation.
http://udn.epicgames.com/Three/PhysXParticleSystemReference.html

Profiling PhysX Physics Simulations
Physics simulation of objects via the PhysX physics engine during play can add a great deal of realism and visual polish to your game, but it also has the potential to affect performance. In order to monitor and analyze the physics simulation, Unreal Engine 3 provides some built-in features to visualize and output information. Third party tools are also provided by nVidia which enable very detailed profiling capabilities.
http://udn.epicgames.com/Three/PhysXProfilingHome.html

**Topics of Interest** 
  •  Basic Game Physics
  • Basic Game Physics: Technical Game Development II





No comments:

Post a Comment