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?
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).
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
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.