Playmaker Forum
PlayMaker Updates & Downloads => Share New Actions => Topic started by: sebaslive on August 14, 2015, 01:16:33 PM
-
If your transform has changed in any way this will set the bool to true, if it is still it will set your bool to false.
Excellent way to tell when an object is in motion.
-
cool.. thx for all your actions.. :D
can they be found on the ecosystem?
-
I don't think so? Does Jean put them in manually or is it something I have to do?
-
Hi,
i can do it for you
-
Hi,
Your action was not working correctly, when the action starts it sends a true value and then goes to false.
so i updated it so it works correctly, also i added a send event and removed the every frame option (the action can not work if not every frame)
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
// Action made by : Sebaslive
// Forum link : http://hutonggames.com/playmakerforum/index.php?topic=10953.0
// Edited by : DjayDino
/*--- __ECO__ __ACTION__ ---*/
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Transform)]
[Tooltip("Sets a bool to true if Transform has changed.")]
public class TransformHasChanged : FsmStateAction
{
[RequiredField]
[Tooltip("The GameObject to check if transform has changed.")]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
public FsmBool storeResult;
public FsmEvent changedEvent;
public override void Reset()
{
gameObject = null;
storeResult = null;
changedEvent = null;
}
public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
go.transform.hasChanged = false;
DoTransformHasChanged();
}
public override void OnUpdate()
{
DoTransformHasChanged();
}
void DoTransformHasChanged()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null) return;
if (go.transform.hasChanged)
{
if (storeResult != null)
{
storeResult.Value = true;
}
Fsm.Event(changedEvent);
}
if (!go.transform.hasChanged)
{
storeResult.Value = false;
}
go.transform.hasChanged = false;
}
}
}
i will add this to the EcoSystem when you are ok with it :)
-
Oh thanks for the help, and you are right about the every frame, I always tested it with that option on. I will double check all the options next time :P
-
Np,
i have added it to the EcoSystem