Game Development Reference
In-Depth Information
Another method for increasing efficiency of physics calculations is through the use of layers . Layer
is one of the properties found in the Inspector that is used to categorize a game object by group.
Just as game objects can have the same tag, game objects can also share the same layer. The
Collision Matrix at the bottom of the Physics Manager is used to select which layers will interact with
which other layers in the scene. Only game objects in layers that interact can collide, reducing the
processing load.
A standard practice when working with complex game objects that require colliders is to use a
collection of child primitive colliders rather than a mesh collider where possible. Mesh colliders take
up a lot of processing power, and have limitations such as not registering collisions with other mesh
colliders. You have seen an example of this technique with the collection of primitive colliders used
for the ragdoll effect.
Time Manager
The Time Manager has two properties that contribute to physics optimizations (Figure 12-10 ). You
know that you use the FixedUpdate() function for physics-related code because physics calculations
depend on fixed time intervals to produce realistic game object behavior. You can use the Fixed
Timestep property to adjust the fixed time interval. The optimization tradeoff here is that the higher
time interval between updates reduces computational demand on the processor, but the physics will
be less accurate.
Figure 12-10. Project Settings Time Manager
The Maximum Allowed Timestep property also helps maintain a fixed time interval by capping the
amount of time spent on physics calculations, so the physics engine doesn't bog down the frame
rate if there are too many fixed updates during a fixed time interval.
Audio Manager
In the Audio Manager, the DSPBuffer Size property pertains to optimization (Figure 12-11 ). Latency
refers to the lag time before a sound is played. The options are fairly self-explanatory, where Best
latency favors more responsive sound over performance, Best performance favors sound quality
over latency, and Good latency balances between latency and performance.
 
Search WWH ::




Custom Search