Getting physics to work in Unreal Engine is simple, but mastering it and achieving flawless results can be difficult.
This blog post explores the physics options available in Unreal Engine 5, as well as practical solutions to common physics challenges.
In this tutorial, we will work with a Static Mesh in the shape of a Sphere.
Please read our actors guide first if you don’t know how to create a Sphere in Unreal Engine 5.
How to enable Physics in Unreal Engine
Start by putting the object you want to add physics to into your level.
When you do this, you might notice that the object doesn’t move with physics right away, even if it looks like a sphere.
This happens because using physics takes up a lot of computer power, so you need to be careful about how you use them if you want your game to run smoothly at 60 frames per second or more.
So, how do we add physics to a static mesh?
How to Simulate Physics
- Select the Static Mesh for which you want to enable physics.
- Go to the details panel and check the ‘Simulate Physics‘ box in the Physics Section.
- Also, make sure ‘PhysicsActor‘ is selected in Collision Presets.
Here is a list of all available options:
- Simulate Physics
- Mass (kg)
- Linear Damping
- Angular Damping
- Enable Gravity
- Constraints: Lock position, rotation and mode.
- Ignore Radial Impulse
- Ignore Radial Force
- Apply Impulse on Damage
- Replicate Physics to Autonomous Proxy
- Async Physics Tick Enabled
- Inertia Conditioning
- Walkable Slope Override: Behavior and Angle
- Auto Weld
- Start Awake
- Center of Mass Offset
- Mass Scale
- Max Angular Velocity
- Sleep Family
- Inertia Tensor Scale
- Custom Sleep Threshold Multiplier
- Stabilization Threshold Multiplier
- Generate Wake Events
- Update Mass when Scale Changes
- Should Update Physics Volume
Physics and Blueprints
Continuous Collision Detection (CCD)
Continuous Collision Detection (CCD) is an Unreal Engine technique for ensuring accurate collision detection and handling of fast-moving objects.
Traditional collision detection methods can sometimes miss collisions or produce inaccurate results when objects are in motion, especially at high speeds, because they check for collisions only at discrete time steps.
CCD addresses this problem by extending collision detection into the time interval between frames, ensuring that even fast-moving objects are detected and handled correctly.
While CCD helps prevent unrealistic collisions, it can also introduce performance overhead due to its computational complexity and impact on processing time. Striking a balance between accuracy and performance is essential when deciding whether to use CCD or not.
You can enable CCD by using the Blueprint ‘Set Use CCD‘.
What means Wake and Sleep Physics?
In Unreal Engine 5, the physics system quickly makes objects go ‘to sleep’.
This means that when an object stops moving, it won’t check for collisions anymore, unless the other object with which it collides is also a physics object.
Consequently, using the Blueprint node ‘Wake Rigid Body‘ with an ‘On Component Sleep‘ event can help solve this issue.
When the physics engine tries to put the object to sleep, the event will trigger and ‘Wake Rigid Body‘ will force the object to wake up and start reacting to collision events from non-physics objects.
What is Teleport in Unreal Engine?
Teleport moves objects to the new position instantly, without affecting their velocity.
If this option is enabled, the physics velocity for this object remain unchanged.
If it’s disabled, physics velocity is updated based on the new position.
Physical Material in Unreal Engine
Sometimes you will need more freedom and options. That’s when a Physical Material comes in handy.
Simply right-click in the content browser and select Physics –> Physical Material to create one.
After that, just apply it to the Static Mesh that has physics enabled.
You will now have more physics options available to you:
- Friction
- Static Friction
- Friction Combine Mode
- Override Friction Combine Mode
- Restitution
- Restitution Combine Mode
- Density
- Sleep Linear Velocity Threshold
- Sleep Angular Velocity Threshold
- Sleep Counter Threshold
- Raise Mass to Power
- Destructible Damage Threshold Scale
- Surface Type
I hope you found the information here useful. Happy creating!
Unreal Engine Roadmap
Next Lesson
Previous Lesson