Is there such kind of hook?

Hi guys. Is there any hook that describe such kind of event: the entity A is put on the entity B by physics gun.

What I am trying to say is that I spawn two entities made by myself (actually just two boxes). And when box A is put on the box B by physics gun, I wish a window will pop up, or something else will happen.

Is it possible to realize it?


you would use ent:Touch and then do a check if the activator was entity b and then do someother check if it was done by physgun.

The solution is part of the problem, but you need to think around the problem to get something worthwhile :wink:

It works. I am thinking how to define the facet. For example, the hook can only be triggered when box A touches the bottom side of box B, but not when top is touched.

Your reply is really quickly. Thank you very, very much!

Maybe you could determine the face by comparing their angles and positions.

The following is if the box’s origin is at the bottom of the box.

  1. Figure out the size, height-ways, of box A.
  2. Check if
    a) box B’s Z position is greater than box A’s Z position plus height of box A
    b) box B’s Z position is less than box A’s Z position

If either a or b, then its on the top (if it’s a box). Otherwise, it’s on the side.

You guys are really gifted!!! Thanks a lot!