Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: CPY on March 07, 2014, 03:01:37 AM

Title: Float Operator Subtract results 0??
Post by: CPY on March 07, 2014, 03:01:37 AM
HI
I have some problem using Float Operator of Subtract

I use it to calculate the mouse drag distance.
The result of subtract is always 0.
and it works as well when i use add.

I traced in the FloatOperator.cs by breakpoint in DoFloatOperator() function.
The progress will skip to end directly after the line "switch (operation) "

is there any thing wrong with my setting?
Thanks~
Title: Re: Float Operator Subtract results 0??
Post by: Lane on March 07, 2014, 09:21:12 AM
Try the checkbox Every Frame on the Float Operator.

What is it that you're trying to do here?
Title: Re: Float Operator Subtract results 0??
Post by: CPY on March 10, 2014, 01:37:36 AM
I want to get mouse slide distance.
So, I get the mouse XY when mouse down and up
After mouse up event, I use "float operator" to calculate the difference of end and start.
it is unreasonable to check the every frame.
And also I do have question that why it works as well when i select "add" for testing but "subtract" is 0.

by tracing in the C# source code of "floatoperator.cs"
in DoFloatOperator() function the progress skip to end directly after the line "switch (operation) "

I can not understand why progress don't go to the "case subtract: "....



Title: Re: Float Operator Subtract results 0??
Post by: jeanfabre on March 14, 2014, 07:57:38 AM
Hi,

 you should not use everyframe to compute the sliding distance when the mouse is up, you should only do that if you want to have this value LIVE as the user is dragging with the mouse down, this is likely your problem if that's checked.

bye,

 Jean