Character Controller Push Objects
Allows a CharacterController to push RigidBody objects when colliding with them. Applies force in the opposite direction of the collision normal, useful for creating realistic character interactions with movable objects.
Parameters
| Parameter | Description |
|---|---|
| Character Controller | The CharacterController component that will push objects. |
| Push Force | The force to apply to pushed objects (per second). Higher values create stronger pushes. |
| Pushed Object | (Optional) Stores a reference to the GameObject that was pushed. |
Details
This action automatically detects when the CharacterController collides with objects and applies pushing forces to any RigidBody components found. The push direction is calculated as the opposite of the collision normal, ensuring objects are pushed away from the character.
Key behaviors:
- Only affects non-kinematic RigidBodies
- Push force is applied horizontally (Y component is zeroed out)
- Uses
ForceMode.Impulsefor immediate force application - Force is applied at the collision point for realistic physics
- Updates the Pushed Object reference when collisions occur
Performance
- Update Mode:
OnEventUpdate- only executes when collision events occur - Performance Impact: Very low - only processes during actual collisions
- Event Handling: Automatically registers/unregisters collision callbacks
The action efficiently uses Unity's OnControllerColliderHit event system, ensuring minimal performance overhead when no collisions are happening.
Debugging
Inspector Information:
- Displays the most recently pushed object (if output is assigned)
Common Issues:
- Ensure target objects have RigidBody components (not kinematic)
- Check that CharacterController is properly configured and moving
- Verify push force values aren't too high (causing objects to fly away unrealistically)
- Objects with very high mass may require stronger push forces to move noticeably
Examples
Gameplay Scenarios:
- Puzzle Mechanics: Player pushes blocks to solve environmental puzzles
- Combat Physics: Character can knock objects into enemies
- Exploration: Moving obstacles out of the way to access new areas
- Stealth Gameplay: Accidentally pushing objects creates noise
Best Practices:
- Use the Pushed Object output to trigger additional effects (sounds, particles, scoring)
- Combine with audio actions to play different sounds based on object materials
- Consider object mass when setting push force values
- Test push forces with various object sizes to ensure realistic behavior
- Use in combination with character movement actions for complete interaction systems