Getting stacked weight of actors without adding a specialized component to each actor

I’m creating a game as part of an udemy.com course that is teaching me C++ and Unreal Engine 4. I’m finding the engine really awesome to use now that I am getting a kind of guided tour. I keep experimenting on my own and wanting to solve issues I find with the game.

As part of the game we create a trigger volume on the floor. The trigger volume detects overlapping characters and adds up their masses. Once a threshold mass has been reached the trigger volume opens a door. To the player they just see a lit area of the floor that when they step into it opens the door, but it shuts before they can approach it.

The problem I originally faced was that if I held an object over the floor or if I threw an object into the trigger volume area without allowing it to hit the floor the door would begin to open. So I then made the trigger volume smaller (1cm tall). The idea being that if the object is within 1cm of the floor it is close enough to be considered triggering the door open.

The issue I now face is if I stack objects one on top of the other on the trigger volume obviously only the object actually touching the floor is considered.

How would you guys solve it so that I can’t just hold an object above the floor and have the door open and so that I can stack objects one on top of the other and have the door open?

EDIT: clarity

In thinking about how to phrase my question I came up with more keywords to search and I found this related question: https://answers.unrealengine.com/questions/320433/is-there-a-way-to-detect-how-much-weight-is-on-an.html

It has no answers though yet :(.

Off the top of my head, I think I would do the bigger volume solution but then only add an actor’s mass if it’s at rest (i.e. the physics component’s velocity is near zero), and the actor wasn’t attached to a character (i.e. AttachParent is NULL).

Maybe check velocity and ignore objects that are moving in weight computations

You can eliminate from computations unwanted flying pawns that can stop in air via collision channels

Alternativly you can also check collision from actor side if it touch the object or ground

So i convert it to answer :> mark as resolved if it really solved your problem

There is collision channels which you can make different objects interact differently (for example you can make barrier that don’t let pass player but let pass projectiles from his gun), it’s explained in this blog:

As traces use collision system it effected by it too.

You can make custom collision chanells in project settings, they are stored in ini files

Yes :slight_smile:

AttachParant seems like it could be exactly what I need to eliminate objects I keep hovering over the ground. Thanks for that!

Could you elaborate on what is meant by “You can eliminate from computations unwanted flying pawns that can stop in air via collision channels”.

Sounds like “check collision from actor side if it touch the object or ground” might be closer to what I’m looking for. I guess I just don’t know enough about collisions yet.

ah, ok. So I think you mean to say that if there is a class of actors that I want to fly around but not affect the trigger volume I can do that using collision channels. Sorry I didn’t quite get that.