playMaker

Author Topic: Trying to use the mousewheel - issues  (Read 2380 times)

random1

  • Playmaker Newbie
  • *
  • Posts: 14
Trying to use the mousewheel - issues
« on: July 02, 2013, 03:39:33 AM »
I'm trying to use the mouse-scroll wheel to allow the player to rotate an object.

I have a Get Axis that gets the mousewheel and puts it into a variable.

I then use a floatCompare to see if the variable is > or < 0 and send it accordingly. I don't care how much the wheel has rotated. Just if it has.

Problem is, PM errors out with this:

Quote
pf_unit(Clone) : Rotation : Loop count exceeded maximum: 1000 Default is 1000. Override in Fsm Inspector.

So I tried setting the variable to a value of 0 after it got to the new state, but that made no difference.

So how do I use it? As best I can tell it should be something like this (based on http://hutonggames.com/playmakerforum/index.php?topic=3329.0 ).

Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Trying to use the mousewheel - issues
« Reply #1 on: July 02, 2013, 05:34:49 AM »
Hi,

you need to separate your logic into two fsm to avoid the infinite loop and send a global event when mouse wheel scrolls and when mouse wheel stop scrolling, don't send an event everyframe, that's not really a good practice imo.

Also, the other way around, is to have two states, where one checks if the mousewheel scrolls, and move to the second state, and in that second state, check if the mouse is NOT scrolling, which would transit back to the first state. This way you avoid infitie looping.

Does that make sense?

bye,

 Jean

random1

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Trying to use the mousewheel - issues
« Reply #2 on: July 03, 2013, 12:13:29 PM »
Hi Jean,
I'm afraid that doesn't make sense.

a) Why does it end up with an infinite loop?
b) How do I detect when scrolling has stopped?
c) Why when I added a "Get Axis" and the float compare did the camera zoom in/out? I have nothing in any script or FMS that I'm aware of that does that. As soon as I remove the float compare it stopped zooming (though the rotation still didn't work).

Thanks.
Jonathan

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Trying to use the mousewheel - issues
« Reply #3 on: July 04, 2013, 07:00:03 AM »
Hi,

 --Please find a small example showing how to check for such value without having infinite loop problem.

-- To check for the scroll to stop, simply check that the scroll value is 0, that's all there is to it.

-- as for your camera, I am not sure, it's likely your fsm logic that does this. You do mean the camera gameobject, not the fsm editor view right?

bye,

 Jean