Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on July 11, 2012, 06:28:39 AM

Title: trigo Sine
Post by: jeanfabre 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

 
Title: Re: trigo Sine
Post by: santelia 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?
Title: Re: trigo Sine
Post by: jeanfabre on July 11, 2012, 07:48:25 AM
Hi,

 yes, just replied actually.

 bye,

 Jean
Title: Re: trigo Sine
Post by: jeanfabre 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 (https://hutonggames.fogbugz.com/default.asp?W971)

 If you want more trigo actions, let us know.

bye,

 Jean