Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: justifun on February 16, 2020, 02:34:06 PM

Title: How to check if two objects are overlapping?
Post by: justifun 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


Title: Re: How to check if two objects are overlapping?
Post by: LeDisciple 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