playMaker

Author Topic: square root  (Read 3861 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
square root
« on: August 30, 2012, 04:36:43 AM »
Hi,

 Following a post, please find an action to return the square root of a float.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Math)]
[Tooltip("Get a Float Variable square root value")]
public class FloatSquareRoot : FsmStateAction
{

public FsmFloat floatVariable;

[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat result;

public bool everyFrame;

public override void Reset()
{
floatVariable = null;
result = null;

everyFrame = false;
}

public override void OnEnter()
{
DoFloatSquareRoot();

if (!everyFrame)
Finish();
}

public override void OnUpdate()
{
DoFloatSquareRoot();
}

void DoFloatSquareRoot()
{
if (!result.IsNone)
{
result.Value = Mathf.Sqrt(floatVariable.Value);
}

}
}
}

bye,

 Jean

Rbanninga

  • Playmaker Newbie
  • *
  • Posts: 17
Re: square root
« Reply #1 on: November 09, 2015, 08:28:08 AM »
Just posting on this one Jean as a possible missed action for the latest version of playmaker? I could not find the Squareroot math function as a default in Playmaker.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: square root
« Reply #2 on: November 10, 2015, 11:47:57 AM »
Hi,

 It's on the Ecosystem.



 Bye,

 Jean