# Is there a way to detect crushing a player?

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329>\
**Category:** World Creation\
**Tags:** weight, force, unreal-engine, Collision, player, Blueprint, question\
**Created:** [February 13, 2019, 5:16pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329 "2019-02-13T17:16:32Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![AliceHalley](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alicehalley/32/1033330_2.png) [@AliceHalley](https://forums.unrealengine.com/u/AliceHalley)\
**Post date:** [February 13, 2019, 5:16pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/1 "2019-02-13T17:16:32Z")

</div>

Is there a way to detect if the player is getting crushed between two assets? I honestly can’t figure this one out. I also can’t really cheat though it by simply using a simple collision detection. I need to figure out if an object capable of crushing the player, even if it isn’t moving all that fast.  
Any suggestions?

To add additional Detail: This needs to be quite dynamic and I will likely need to implement more systematic methods of calculating when a player should be crushed by an object. Since my objects can have different velocities, weights, movement directions, and also inherit the unpredictable nature of simulated physics, I am going to opt for a less contextual method.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [February 13, 2019, 5:30pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/2 "2019-02-13T17:30:35Z")

</div>

I’d say crushing will certainly result in Collision Capsule’s clipping through one or another object, be it a wall or a rolling boulder or anything else. So you can place a smaller capsule inside the main one and if it overlaps anything but the main capsule, it means there’s not enough space for the character between two objects and he is probably being crushed right now.

---

<div class="post-metadata">

**Author:** ![AliceHalley](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alicehalley/32/1033330_2.png) [@AliceHalley](https://forums.unrealengine.com/u/AliceHalley)\
**Post date:** [February 13, 2019, 10:15pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/3 "2019-02-13T22:15:38Z")

</div>

Sadly this doesn’t work. My Physics are quite tight, and I don’t get clipping. None of my physics assets clips through the player capsule, they just stop upon impact.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [February 14, 2019, 7:14am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/4 "2019-02-14T07:14:31Z")

</div>

Now you’ve got me confused. You want to detect player crushing, but the crushing never actually happens? How is that supposed to work then?

---

<div class="post-metadata">

**Author:** ![AliceHalley](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alicehalley/32/1033330_2.png) [@AliceHalley](https://forums.unrealengine.com/u/AliceHalley)\
**Post date:** [February 14, 2019, 10:24am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/5 "2019-02-14T10:24:50Z")

</div>

If I drop a five tonne physics object on my player, it should within all reason crush and kill them, because it’s a five tonne weight. But it wont clip through the player.

I wouldn’t want it to clip through my player anyway, since I don’t want a glitch dictating my game mechanics.

The way I imagined it would work is that there would be some sort of method to detect the oncoming force, dynamically detect if I am up against another surface, and have a threshold of crushing force to kill the player, I just don’t know how I would calculate that or if it’s even possible. I don’t know “how that is supposed to work” that’s the whole reason I’m on Ue4 answerHub asking in the first place.

---

<div class="post-metadata">

**Author:** ![predspread](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@predspread](https://forums.unrealengine.com/u/predspread)\
**Post date:** [February 14, 2019, 11:09am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/6 "2019-02-14T11:09:36Z")

</div>

Velocity check of the crushing object to see whether it’s above the threshold of negative Z (i.e. going fast enough downwards) and a collision detection between the object and the player’s head ought to do the trick.

---

<div class="post-metadata">

**Author:** ![AliceHalley](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alicehalley/32/1033330_2.png) [@AliceHalley](https://forums.unrealengine.com/u/AliceHalley)\
**Post date:** [February 14, 2019, 11:16am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/7 "2019-02-14T11:16:02Z")

</div>

Hi, this sounds like a step in the right direction, I will give it some tests, but might have to try and factor in other variables such as the weight of the object, calculating the momentum, and also the velocity of the player.

But in order this this to work, do you know how I could determine if the player is being crushed up against something? A huge block pushing the player from the side shouldn’t within all reason kill them outright unless it is pushing them into a surface and crushing them, do you know how I would detect such a thing?

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [February 14, 2019, 11:23am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/8 "2019-02-14T11:23:18Z")

</div>

You can use multi trace in the direction of movement to detect the character first and then if there’s something behind him, and get the distance between the character and the surface.

---

<div class="post-metadata">

**Author:** ![predspread](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@predspread](https://forums.unrealengine.com/u/predspread)\
**Post date:** [February 14, 2019, 11:33am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/9 "2019-02-14T11:33:19Z")

</div>

I think you would want to put this within your player blueprint. Depending on the size of your objects, you wouldn’t want your player to die from a piece of paper falling on them. Therefore, whenever a collision between the player and an object occurs, you want to check the size of the object with “GetComponentBounds” or “GetActorBounds”. If the object is bigger than whatever threshold you set, you can kill the player or deal damage based on the amount over the threshold that the object is (e.g. 5% over = 10% hp damage, 50% over = death).

For a sideways crush, I would do the same thing but for both objects, then determine the direction that the crushing object(s) are moving. For example:

- If both objects are moving towards the player and are colliding with the player, AND exceed the threshold that I mentioned before, then the player will die.
- If one object is moving towards the player and is colliding with the player BUT there is no other collision, move the player in the direction _that the object is travelling_.
- If one object is moving towards the player and is colliding with the player AND there is another collision object BUT the other object is not moving, do a check to see whether the second object is above the threshold and deal damage based on the size and velocity of the initial moving object.

Just a few ideas.

Edited for clarity.

---

<div class="post-metadata">

**Author:** ![AliceHalley](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alicehalley/32/1033330_2.png) [@AliceHalley](https://forums.unrealengine.com/u/AliceHalley)\
**Post date:** [February 14, 2019, 11:35am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/10 "2019-02-14T11:35:22Z")

</div>

Fantastic, I will give these a go and update you on my progress. Cheers!

---

<div class="post-metadata">

**Author:** ![AliceHalley](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alicehalley/32/1033330_2.png) [@AliceHalley](https://forums.unrealengine.com/u/AliceHalley)\
**Post date:** [February 14, 2019, 12:07pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/11 "2019-02-14T12:07:58Z")

</div>

Hi Chyros, thank you for the suggestion. Unfortunately my system needs to be quite dynamic and I will likely need to implement more systematic methods of calculating when a player should be crushed by an object.  
Since my objects can have different velocities, weights, movement directions, and also inherit the unpredictable nature of simulated physics, I am going to opt for a less contextual method.

I will definitely keep your method in mind, for if I decide to utilize hazards later in the game with my restrictive movement, your method could work in a pinch.

---

<div class="post-metadata">

**Author:** ![Chyros](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chyros](https://forums.unrealengine.com/u/Chyros)\
**Post date:** [February 14, 2019, 12:58pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/12 "2019-02-14T12:58:19Z")

</div>

You should have mentioned that on your question. Here’s how I would check the force from an incoming object:

 ![268589-j-02-force-check.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/0/0/200ecc2cefa2988a9110a65f34b746e26c70f630.png)

---

<div class="post-metadata">

**Author:** ![AliceHalley](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alicehalley/32/1033330_2.png) [@AliceHalley](https://forums.unrealengine.com/u/AliceHalley)\
**Post date:** [February 14, 2019, 1:20pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/13 "2019-02-14T13:20:48Z")

</div>

I did say “I also can’t really cheat though it by simply using a simple collision detection. I need to figure out if an object capable of crushing the player”. But none the less, I have added more details to the question for the time being.

---

<div class="post-metadata">

**Author:** ![Chyros](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chyros](https://forums.unrealengine.com/u/Chyros)\
**Post date:** [February 14, 2019, 2:20pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-detect-crushing-a-player/443329/14 "2019-02-14T14:20:40Z")

</div>

Yes that’s why I posted above how to compute force on hit which involves mass and velocity.
