playMaker

Author Topic: trigo Sine  (Read 3839 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
trigo Sine
« on: July 11, 2012, 06:28:39 AM »
Hi,

 Following a request, please find an action to get the Sine. I will carry one building the rest of trigo actions to voer the whole possibilities.

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

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("trigonometry")]
[Tooltip("Get the sine. You can use degrees, simply check on the DegToRad conversion")]
public class GetSine : FsmStateAction
{
[RequiredField]
public FsmFloat angle;

public FsmBool DegToRad;

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

public bool everyFrame;

public override void Reset()
{
angle = null;
DegToRad = true;
everyFrame = false;
result = null;
}

public override void OnEnter()
{
DoSine();

if (!everyFrame)
Finish();
}

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

void DoSine()
{
float _angle = angle.Value;
if (DegToRad.Value)
{
_angle = _angle*Mathf.Deg2Rad;
}
result.Value = Mathf.Sin(_angle);
}
}
}

 bye,

 Jean

 

santelia

  • Junior Playmaker
  • **
  • Posts: 78
Re: trigo Sine
« Reply #1 on: July 11, 2012, 07:32:16 AM »
Thank you Jean. It's surely useful for getting things run when route calculations are involved.

Please, take also a look at our problem  :(  in creating a custom math action to find route points:

http://hutonggames.com/playmakerforum/index.php?topic=1924.0

Any help for that?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: trigo Sine
« Reply #2 on: July 11, 2012, 07:48:25 AM »
Hi,

 yes, just replied actually.

 bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: trigo Sine
« Reply #3 on: July 13, 2012, 09:01:33 AM »
Hi,

 ok, I added the rest of the actions, you can get them here:
https://hutonggames.fogbugz.com/default.asp?W971

 If you want more trigo actions, let us know.

bye,

 Jean