playMaker

Author Topic: How to trigger variable based on two objects touching?  (Read 1862 times)

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
How to trigger variable based on two objects touching?
« on: May 29, 2016, 08:59:22 AM »
Ok, Beginner question!

I'm trying to use playmaker for interactions via a motion controller.  So I need it to do this...

IF game object A is touching (or close enough to) game object B AND button 1 is pressed THEN change state.

I've found a function that compares 2 variables that I can use, but cant figure out how to tell playmaker that the two objects are close enough.  I don't really mind if this is done with distance or collision.

Any ideas? I'm currently making the transition for GameFlow to Playmaker and it's a steep learning curve.

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 219
Re: How to trigger variable based on two objects touching?
« Reply #1 on: May 29, 2016, 12:19:25 PM »
Several ways you can do it.. heres one.

use TRIGGER EVENT to determine if things are touching (after you add rigidbody colliders).  If they are, use a boolean called isTouching to store the info.

Now onto your motion controller button.  You can have it when the button is pressed, it first uses GET FSM BOOL, to target the object that has the trigger events on it.  Then if the boolean isTouching is true, perform the action you want, if isTouching is false, perform action.

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: How to trigger variable based on two objects touching?
« Reply #2 on: May 29, 2016, 06:12:28 PM »
Thanks!  That helped, got it working now.