-1

I got this Question: how to detect if a Character got in a room?

The situation is: I'm working on this elevator that people could get in, and every time a pawn gets in the elevator, the elevator will get the pawn's weight and to see if it's gonna be over-wieight.

But i have problem detecting if the pawn has got inside the elevator.

I have set a 'Box Collision' at the edge of the elevator, evert time the 'Box Collision" is overlapped by a pawn, it's gonna get the pawn's ref and everything. As presented in the image. enter image description here enter image description here But the problem is: every time the pawn crosses the 'Box Collison', it will be triggered twice or even more. I don't really understand this?

Or is there an advance way to detect if the pawn has got inside this elevetor or such kind of space?

Let me know if u don't get the question.

Anyway help would be appreciated!

MarkLilyCC
  • 13
  • 1
  • 4

3 Answers3

0

More than one component in your pawn may be overlapping with this trigger box. If you print the name of 'Other Comp' you will see which.

More to the point, this seems like the wrong shape for what you are trying to detect. This will tell you if a pawn has crossed the line leading into the elevator. It will not tell you if the pawn is currently in the elevator. You have no way of knowing if a pawn is going in, going out, or is just standing somewhat close to the line. It would be more ideal to make the collision box the size of the entire elevator, then handle both BeginOverlap and EndOverlap as indicators for pawn is in/out of elevator.

Rotem
  • 21,452
  • 6
  • 62
  • 109
0

Measuring the total weight of the elevator has some points in handling it entering, but it also has a problem in that it has to measure exiting. When adding as BoxCollision, have an array of things throughout the elevator and use Add Unique for new additions. For exit, you can call remove for this array.

sun linkan
  • 36
  • 1
0

It's better to create a triggerbox of an elevator room size. And blueprint is something like this enter image description here