playMaker

Author Topic: How to check if two objects are overlapping?  (Read 997 times)

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
How to check if two objects are overlapping?
« on: February 16, 2020, 02:34:06 PM »
Consider a player is holding an object like a battery, and when the let go of the object, the game needs to check if its overlapping the correct location where its supposed to go eg: a generator

In playmaker how to do check if two objects are overlapping?

Pseudo code: On item drop -> if battery is overlapping generator -> snap battery to generator battery compartment


One approach I've tried is that the battery is using a trigger on enter event to check which other object its constantly colliding with and storing that in a game object variable, then when the player lets go of the object I check if that variable is equal to the game object name of where it "should" go and if they match then it snaps to that position.  But i feel like there's an easier way to accomplish this.

thx



LeDisciple

  • Playmaker Newbie
  • *
  • Posts: 35
Re: How to check if two objects are overlapping?
« Reply #1 on: February 16, 2020, 07:26:18 PM »
Hi, You can use mouse pick to raycast over the detected object to spawn or position your object
« Last Edit: February 17, 2020, 02:31:09 AM by LeDisciple »