View
19
Download
0
Category
Preview:
DESCRIPTION
Collision - UE
Citation preview
Search Documentation...English
Collision OverviewOn this page:
Interactions
Common Collision Interaction Examples
Collision
Collision and Simulation Generates Hit Events
Overlap and Ignore
Overlap and Generate Overlap Events
Collision Responses and Trace Responses form the basis for how Unreal Engine 4 handles collision and ray casting during run time. Everyobject that can collide gets an Object Type and a series of responses that define how it interacts will all other object types. When a collision or
overlap event occurs, both (or all) objects involved can be set to affect or be affected by blocking, overlapping, or ignoring each other.
Trace Responses work basically the same way, except the trace (ray cast) itself can be defined as one of the Trace Response types, thuslyallowing Actors to either block it or ignore it based on their Trace Responses.
Interactions
There are a few rules to keep in mind with how collisions are handled:
Blocking will naturally occur between two (or more) Actors set to Block. However, Simulation Generates Hit Events needs to beenabled to execute Event Hit, which is used in Blueprints, Destructible Actors, Triggers, etc...Setting Actors to Overlap will often look like they Ignore each other, and without Generate Overlap Events, they are essentially thesame.
For two or more simulating objects to block each other, they both need to be set to block their respective object types.
For two or more simulating objects: if one is set to overlap an object, and the second object is set to block the other, the overlap will occur
but not the block.
Overlap events can be generated even if an object Blocks another, especially if traveling at high speeds.
It is not recommended for an object to have both collision and overlap events. Though possible, there is much that needs manual
handling.
If one object is set to ignore and the other is set to overlap, no overlap events will be fired.
For purposes of testing levels and looking around your worlds:
The default Play In Editor camera is a pawn. Thusly can be blocked by anything set to block pawns.The Simulate in Editor camera, before possessing anything, is not a pawn. It can freely clip through everything and will not create anycollision or overlap events.
Common Collision Interaction Examples
These interactions assume that all the objects have Collision Enabled set to Collision Enabled so they are set to fully collide witheverything. If collision is disabled, it is as if ignore has been set for all Collision Responses.
For the following section, this will be the setup used to explain what is happening:
The sphere is a PhysicsBody and the box is WorldDynamic, and by changing their collision settings we can get a number of behaviors.
Collision
By setting both of their collision settings to block each other, you get a collision, great for having objects interact with each other:
Collision
Physics Bodies
Collision
Collision Overview
Collision How To's
Collision Response Reference
Physical Materials
Physics Constraints
Destructible Properties Matrix
APEX
APEX Types
Physics Asset Tool (PhAT)
Vehicles User Guide
Vehicle Art Setup
How to Build a Double Wishbone
Suspension Vehicle
Walkable Slope
Physics SubStepping
Landscape Outdoor Terrain
Matinee and Cinematics
Localization
InGame Analytics
Level Streaming
Saving Your Game
<
GET UNREAL
Sphere Collision Setup Wall Collision Setup
In this case, the sphere is a PhysicsBody and it is set to block
WorldDynamic (which is what the wall is).
The wall is a WorldDynamic and is set to block PhysicsBody
Actors (which is what the sphere is).
In this case, the sphere and the wall will simply collide; no further notifications of the collision will take place.
Collision and Simulation Generates Hit Events
Just collision is useful and in general, the bare minimum for physics interactions, but if you want something to report it has collided so aBlueprint or section of code can be triggered:
Sphere Collision Setup Wall Collision Setup
As in the example above, the sphere is a PhysicsBody and it is set to
block WorldDynamic (which is what the wall is). However, the
sphere has also enabled Simulation Generates Hit Events so it will
trigger an event for itself whenever it collides with something.
The wall is a WorldDynamic and is set to block PhysicsBody
Actors (which is what the sphere is). Since the wall is not set to
Simulation Generates Hit Events, it will not generate an event
for itself.
With the sphere set to Simulation Generates Hit Events, the sphere will tell itself that it has had a collision. It will fire off events such asReceiveHit or OnComponentHit in the sphere's blueprint. Now if the box had an event for collision, it would not fire because it will never notifyitself it has happened.
Further, an object that is reporting rigid collisions will report them all and spam reports when it is just sitting on something, so it is best to be
careful to filter what it is colliding within its blueprint or in code.
Overlap and Ignore
For all intents and purposes, Overlap and Ignore work exactly the same assuming Generate Overlap Events is disabled. In this case, thesphere is set to overlap or ignore the box:
Sphere Collision Setup Wall Collision Setup
Here the sphere is set to overlap WorldDynamic Actors (like our
wall), but it does not have Generate Overlap Events enabled. As far
as the sphere is concerned, it has not collided or overlapped
anything, effectively it has ignored the wall.
The wall is a WorldDynamic and is set to block PhysicsBody
Actors (which is what the sphere is). As stated above, both
Actors need to be set to block each other's respective object
types. If they do not, they will not collide.
Or:
Sphere Collision Setup Wall Collision Setup
Here the sphere is set to ignore WorldDynamic
Actors (like our wall), and it will pass through the
wall.
The wall is a WorldDynamic and is set to block PhysicsBody Actors (which is what
the sphere is). As stated above, both Actors need to be set to block each other's
respective object types. If they do not, they will not collide.
Overlap and Generate Overlap Events
Unlike collisions that can fire every frame, the overlap events are ReceiveBeginOverlap and ReceiveEndOverlap, which only fire in thosespecific cases.
Sphere Collision Setup Wall Collision Setup
Here the sphere is set to overlap WorldDynamic
Actors (like our wall), and it will generate an event
for itself when it does overlap something.
The wall is a WorldDynamic and is set to block PhysicsBody Actors (which is what
the sphere is). As stated above, both Actors need to be set to block each other's
respective object types. If they do not, they will not collide. But, an Overlap does
occur here, and an event for the sphere is fired.
Full Topic Index
© 20042015, Epic Games, Inc. All rights reserved. Unreal and its logo are Epic’s trademarks or registered trademarks in the US and
elsewhere.
TERMS OF USE | PRIVACY POLICY
Recommended