playMaker

Author Topic: Float Operator Subtract results 0??  (Read 2110 times)

CPY

  • Playmaker Newbie
  • *
  • Posts: 4
Float Operator Subtract results 0??
« 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~

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Float Operator Subtract results 0??
« Reply #1 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?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

CPY

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Float Operator Subtract results 0??
« Reply #2 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: "....




jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Float Operator Subtract results 0??
« Reply #3 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