Questions regarding primitive movement and Engine/Physx collision

Hello all,

I have a question regarding how collision sweeps are handled for a moving root primitive component with Physx Sim on versus Physx Sim Off with child primitive colliders moving with the root component.


I’ve spent some time in the engine writing a custom airplane movement component to learn the inner workings of the Engine. I am currently at the stage now of investigating how collision works and want to implement my own collision resolution to either combine or modify with what’s written by UE4 (Two Wall Adjust, Slide Against Wall etc). I’ve went through the movement code and understand how movement is handled inside the class UPrimitiveComponent::MoveComponentImpl. In a nutshell this function handles Collison Events and Overlap Notifications of the sweeping component during movement updates. Additionally, bMoved is set to true or false to control if the object is allowed to move or not based on a sweeping blocking hit. If there is a path to sweep out then we can move, otherwise do not; this implementation is perfect for pre collision resolution implementation and most likely won’t be modified much.


At the beginning, I made my root component to move with only a collision box, but later decided take a different approach to tighten my colliders and attach multiple primitive components (boxes and cylinders) to wrap the static mesh while having the root primitive be a sphere overlapping with no collision as it moves.

This is how it looks with the colliders:

There appears to be several solution approaches to get Hit Events from multiple colliders that PhysX resolves for us after a sweep.

  1. Taking advantage of Physx Rigid body Simulation so we can handle the hit events of the children primitives since they are welded together with the root.
  2. Override the Box and Capsule Components to sweep, collect the hit events then notify the root component whether it’s allowed to move or not and then perform the collision resolution.
  3. The last option, construct a custom primitive component shape by passing vertices to it and sweep that (Probably won’t do this).

Here are some video examples to show this behavior.

PhysX Sim Off (Hit Events not triggering for children) -

PhysX Sim On (Root Simulating) -

It appears that when PhysX sim is on if I hit something the PhysX sim applies another velocity vector and messes with my movement (which makes sense)

Currently to move the component I am passing calculated delta values of to my own to the MoveUpdatedComponent function which is gonna be wrapped around SafeMoveUpdatedComponent to be modified later for collision resolution. Down the call chain this will eventually call UpdatedComponent->MoveComponent where some questions arise about how movement is really resolved by the engine with PhysX


  1. I’m updating the scene component velocity (from the primitive class) after I perform a movement update but how is PhysX changing this value when sim is on and where is this in engine source code?
  2. When in collision a impulse vector is accumulated and being applied on top of my movement, clearly this is not the case when PhysX sim is off.
  3. Bringing the first two questions together I really just want to know where this is happening in engine code so I can understand it’s interface so I can document this knowledge for future projects where I can explore making cool new movement mechanics.

Side Notes:

  • Chaos is going to replace Physx soon anyway but I assume Chaos might behave this way also.
  • Upon looking into the engine code, it appears that all the primitives shapes get casted to a body instance even if sim is on or off, I assume this is for PhysX to consume to give us sweep results for the given geometry but I am not 100 percent sure.
  • I want to learn how to code Client Prediction after collision is completed so my intuition is to implement option 2 and avoid running a PhysX Sim when processing individual collider hit events.

Thanks very much and looking forward to discuss this topic.