playMaker

Author Topic: "Remote" Clicking (Binding Two Gameobjects Mouse Events) [SOLVED]  (Read 1666 times)

Sebby

  • Playmaker Newbie
  • *
  • Posts: 7
Let's Say I had 2 Squares with BoxColider2Ds on each.

When I click Square 1, I would like Square 2 to receive a MouseDown event.
When I hover over Square 1, I would Like Square 2 To receive a MouseOver event.

And so on.

I've Tried Execute Events with PointerDown and PointerClick, but to no success, I'm not positive but I think Execute Events is only used for UI?
What I'm trying to accomplish should be able to work outside of UI, in the actual game.

Any insight on to how to do this?

Thanks
« Last Edit: December 12, 2016, 09:01:16 PM by Sebby »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: "Remote" Clicking (Binding Two Gameobjects Mouse Events)
« Reply #1 on: December 06, 2016, 02:26:35 PM »
Hi,
You can use send events and use global transitions.

here is a video about global transitions :


So on square 1 make a state and place the mouse over as a global, then in that state use a send event to square 2

If needed you can make a 2nd fsm on each square when needed and do the send events to the 2nds fsm to do stuff

Sebby

  • Playmaker Newbie
  • *
  • Posts: 7
Re: "Remote" Clicking (Binding Two Gameobjects Mouse Events)
« Reply #2 on: December 06, 2016, 03:52:54 PM »
Hi,
You can use send events and use global transitions.

here is a video about global transitions :


So on square 1 make a state and place the mouse over as a global, then in that state use a send event to square 2

If needed you can make a 2nd fsm on each square when needed and do the send events to the 2nds fsm to do stuff

That would work except, let's say the 2nd square didn't have an FSM and needed to be clicked to work because of the attached script.  How could I send a click event to an object with no FSM from an object with an FSM?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: "Remote" Clicking (Binding Two Gameobjects Mouse Events)
« Reply #3 on: December 07, 2016, 05:48:32 AM »
Hi,
You could look into 'mouse pick event' or 'mouse pick 2D event':

Set "game object" to : specify Game Object,
drop in your square, set "mouse over" or "mouse down" and set "layer mask" if required.

In the next state do what it has to do and also place another 'mouse pick event' or 'mouse pick 2D event' and set "mouse up" if you used mouse down and always set "mouse off"

So if you press and hold down the mouse button and move outside the square it will disable. if you do not use it and you release your mouse outside the square it will not register the mouse up

Sebby

  • Playmaker Newbie
  • *
  • Posts: 7
Re: "Remote" Clicking (Binding Two Gameobjects Mouse Events) [SOLVED]
« Reply #4 on: December 12, 2016, 09:00:56 PM »
Solved this one myself.
Thanks to all who posted responses though.

Feel kind of silly, all I had to do was use Send Message to the script that I wanted to Fake Click, and send "MouseDown" and "MouseEnter" .

It was so simple that I had to over complicate it first, so I could spend a few days sweating haha.