playMaker

Author Topic: Mouse Pick Every Frame not working?  (Read 2178 times)

trsnell

  • Playmaker Newbie
  • *
  • Posts: 8
    • Portfolio
Mouse Pick Every Frame not working?
« on: November 26, 2012, 06:18:02 PM »
I have an FSM set up which allows me to pick up objects with a mouse pick. I based it off of the mouse pick change cursor sample.
It's working fine, except for when I approach an object with my mouse over it. If I do so, it sits at the start state without changing. I have to look away then look back at it to trigger the next event.
The start state just has the mouse pick, with stores the picked object as a variable, and it uses "game object changed" to send the next event (which compares the object's tag and allows certain ones to be picked up).
I would expect the the next event to be triggered as soon as I get within the ray cast distance as determined in the "mouse pick" action. To my logic, checking every frame would cover that (shouldn't the stored game object change once it gets in ray cast range?), but it doesn't.

So I'm not sure if everything is working as it's supposed to, or if every frame isn't doing what it should.
If everything is working as intended, I could use some help figuring out how to fix this! All I've thought of is having the start state send the event every ~1 second, which works well enough, except it slows the game down a ton.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mouse Pick Every Frame not working?
« Reply #1 on: November 27, 2012, 12:42:03 AM »
Hi,

 Odd. Are you sure your objects are tagged properly? If you watch the "Pick" variable is it changing properly as expected? Yes everyframe is about letting the mouse pick check at every new frame, so that should work.

bye,

 Jean

trsnell

  • Playmaker Newbie
  • *
  • Posts: 8
    • Portfolio
Re: Mouse Pick Every Frame not working?
« Reply #2 on: November 28, 2012, 02:08:38 AM »
Yeah, although the weird thing is that it changes to the picked object no matter how far away I am. I messed with the ray cast distance, and the game object variable always changes no matter how far away I am. And for some reason, when I pick the object outside of the ray cast range, it triggers the events, but just goes straight back to reset (i.e., the initial state).

Which appears to be specifically what the problem is- "game object changed" is the event trigger in the initial state, so, because the game object variable is already set to what I'm looking it, it's not changing, thus not sending the next event as it should.