playMaker

Author Topic: Working With Exponents or cuberoot  (Read 3588 times)

90degreedesigns

  • Playmaker Newbie
  • *
  • Posts: 13
Working With Exponents or cuberoot
« on: November 26, 2014, 08:12:56 PM »
I have one of two things I need accomplished with Playmaker. Here is the formula I am using. H and W are both floats.

X=230 * cuberoot(H/W)
X equals 230 times the cube root of H divided by W.

This can be re-written like this:

X = ((H*W)^1/3)*230
X equals the product of H and W with an exponent of 1/3 then multiplied by 230.

How can I reproduce this using playmaker? The most efficient way doesn't seem possible as there is no cuberoot function in playmaker. :-\

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Working With Exponents or cuberoot
« Reply #1 on: November 27, 2014, 01:05:33 AM »
Hi,

You'll need a custom action for this I guess. I'll add this in the Float Operator Advanced.

 Please bump early next week if you haven't heard back from me.

 Bye

 Jean

markadet

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Working With Exponents or cuberoot
« Reply #2 on: July 26, 2017, 10:47:01 PM »
Hello,

The action "Float Operator Advanced" doesn't seem to work in unity >4 (my project is in 5.4) and the error is:

Quote
Assets/PlayMaker Custom Actions/Math/FloatOperatorAdvanced.cs(10,46): error CS0246: The type or namespace name `FsmStateActionAdvanced' could not be found. Are you missing a using directive or an assembly reference?

I need to use exponents based on variables. Is it easily fixable?
Thanks in advance

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Working With Exponents or cuberoot
« Reply #3 on: July 27, 2017, 01:48:00 PM »
Hi,
Strange.
Did you get this from the Ecosystem ?

I just downloaded it and i have no error on my end

markadet

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Working With Exponents or cuberoot
« Reply #4 on: July 27, 2017, 02:39:46 PM »
Thank you for your answer.

Yes. I just redownloaded it (after upgrading the ecosystem from 0.5.0 to 0.5.1) and I still have the same error message after Unity compiling.

Edit: and the precise version of unity I'm using is 5.4.0f3
« Last Edit: July 27, 2017, 02:54:55 PM by markadet »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Working With Exponents or cuberoot
« Reply #5 on: July 28, 2017, 01:21:02 AM »
Hi,
I have added an attachment with the missing script below.

markadet

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Working With Exponents or cuberoot
« Reply #6 on: July 28, 2017, 09:22:29 AM »
Thank you for your help, there is no error message now. I can download & use the action.

But now i can test the action, I see it doesn't seem to manage exponents...  :-\

Do you know why Jean didn't add it in 2014? (forgotten or technical problems?) Or is there another solution?

I want to be able to use float variables with another variable as exponent... I already managed it with a loop, but I'll have to use it again, and it would be better to be done properlywith a single action, I think.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Working With Exponents or cuberoot
« Reply #7 on: July 28, 2017, 01:41:22 PM »
Hi,
I will ask jean :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Working With Exponents or cuberoot
« Reply #8 on: July 31, 2017, 03:14:50 AM »
Hi,

 I simply forgot... d'oh!

I added the operator "power" to the FloatOperatorAdvanced and created a new action GetFloatExponent as well.

 for cubeRoot, simple use float.power(1/3), that's how you get a cuberoot.

Let me know if it works for you.

 Bye,

 Jean

markadet

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Working With Exponents or cuberoot
« Reply #9 on: July 31, 2017, 03:51:25 PM »
It works! Thank you!  :)

(tested with FloatOperatorAdvanced)

Vern_S

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Working With Exponents or cuberoot
« Reply #10 on: December 13, 2017, 09:01:48 PM »
I am trying to calculate various scaling equations such as A*B^.45=C, where B is the base and .45 the exponent. I have installed the Advanced Float Operator and Get Float Exponent actions but can't seem to figure out how to use them. Keep getting 0 using Adv Flt Op and the Power setting. I know I am missing something simple and will feel like an idiot so could someone please show me what to do?

Thanks

Vern_S

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Working With Exponents or cuberoot
« Reply #11 on: December 13, 2017, 10:00:44 PM »
Ok, this is odd. I have several Float Operators Advanced and at the bottom have a Float Compare to pick an event to go with. All of my results from the Float Operator regardless of setting end up not working. If I put the float compare in a new state and use a finish event to go to it everything works fine. I thought the actions take place one after another from top to bottom? It's like the float compare is going first even though it's on the bottom.

Vern_S

  • Playmaker Newbie
  • *
  • Posts: 32
Re: Working With Exponents or cuberoot
« Reply #12 on: December 13, 2017, 10:21:23 PM »
There is something not right with Float Operator Advanced. If something else is in at the end like set scale it returns a 0 regardless of operation. I did a Float Operator Advanced and a set scale as a test and got 0 instead of the multiplied value. When I switched to a regular Float Operator everything works fine.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Working With Exponents or cuberoot
« Reply #13 on: December 14, 2017, 12:58:54 AM »
Hi,

 can you provide a repro scene? together with the expected result, and I'll give it a go and see what's wrong. Thanks :)

 Bye,

 Jean