Search Results for

    Show / Hide Table of Contents

    Physics Settings

    Physics Settings asset is used to specify the initial physics simulation configuration. In fact, some of its options can be set only on physics engine startup so using that asset may be required. Hovewer, most of the physics simulation options can be adjusted at runtime using Physics class.

    Create physics settings

    1. Navigate to the Content directory in the Content window

    2. Right-click and select option New -> Settings, specify the asset name (eg. Physics Settings) and hit Enter
      Tutorial

    3. Choose option Physics Settings and press Create button
      Tutorial

    4. Double-click on an asset to open it and edit
      Tutorial

    Use physics settings

    You can create as many physics settings as you want (even special versions per platform) but only one can be used during game building. Use Game Settings asset (always located in Content/GameSettings.json) to link the physics options. If your game is using more advanced configuration you can edit the game settings from code in your build script (use GameSettings.Load and GameSettings.Save from C# API).

    Use Physics Settings

    Simulation options

    Simulation

    Property Description
    Default Gravity The default gravity value (in cm/(s^2)).
    Bounce Threshold Velocity Minimum relative velocity required for an object to bounce. A typical value for simulation stability is about 0.2 * gravity.
    Friction Combine Mode The default friction combine mode, controls how friction is computed for multiple materials. Possible options:
    OptionDescription
    AverageUses the average value of the touching materials: (a+b)/2.
    MinimumUses the smaller value of the touching materials: min(a,b).
    MultiplyMultiplies the values of the touching materials: ab.
    Maximum*Uses the larger value of the touching materials: max(a, b).
    Restitution Combine Mode The default restitution combine mode, controls how restitution is computed for multiple materials. Possible options:
    OptionDescription
    AverageUses the average value of the touching materials: (a+b)/2.
    MinimumUses the smaller value of the touching materials: min(a,b).
    MultiplyMultiplies the values of the touching materials: ab.
    Maximum*Uses the larger value of the touching materials: max(a, b).
    Disable CCD If checked, CCD will be ignored. This is an optimization when CCD is never used which removes the need for physics engine to check it internally.
    Broad Phase Type Broad phase algorithm to use in the simulation. Possible options:
    OptionDescription
    Sweep And Prune3-axes sweep-and-prune. Good generic choice with great performance when many objects are sleeping.
    Multi Box PruningAlternative broad phase algorithm that does not suffer from the same performance issues as SAP when all objects are moving or when inserting large numbers of objects.
    Automatic Box PruningRevisited implementation of MBP, which automatically manages broad-phase regions.
    Parallel Automatic Box PruningParallel implementation of ABP. It can often be the fastest (CPU) broadphase, but it can use more memory than ABP.
    Enable Enhanced Determinism Enables enhanced determinism in the simulation. This has a performance impact.
    Solver Type The solver type to use in the simulation. Possible options:
    OptionDescription
    Projected Gauss Seidel Iterative SolverThe iterative sequential impulse solver
    Temporal Gauss Seidel SolverNon linear iterative solver. This kind of solver can lead to improved convergence and handle large mass ratios, long chains and jointed systems better. It is slightly more expensive than the default solver and can introduce more energy to correct joint and contact errors.
    Tip

    When Continuous Collision Detection (CCD) is turned on, the affected rigid bodies will not go through other objects at high velocities (a problem also known as tunnelling).

    Framerate options

    Simulation

    Property Description
    Max Delta Time The maximum allowed delta time (in seconds) for the physics simulation step.
    Enable Substepping Whether to substep the physics simulation.
    Substep Delta Time Delta time (in seconds) for an individual simulation substep.
    Max Substeps The maximum number of substeps for physics simulation.

    Layers Matrix options

    Simulation

    Flax physics simulation supports layer-based collision detection. You can specify collisions mask for each layer that will be used to describe if objects from that layer can collide with objects from the other layers.

    This uses the global layers settings and shows them as a layers matrix. Use checkboxes to define the layers collision mask.

    Other

    Other

    Property Description
    Support Cooking At Runtime Enables support for cooking physical collision shapes geometry at runtime. Use it to enable generating runtime terrain collision or convex mesh colliders.
    Triangle Mesh Triangle Min Area Threshold Triangles from triangle meshes (CSG) with an area less than or equal to this value will be removed from physics collision data. Set to less than or equal 0 to disable.
    Queries Hit Triggers If checked, any raycast or other scene query that intersects with a collider marked as a trigger will returns with a hit. Individual raycasts can override this behavior.
    • Improve this Doc
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat