Playmaker Forum
PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on May 10, 2011, 02:45:25 AM
-
Hi,
Here is a adaptation of SetIsKinematic action to control isTrigger for a collider ( after Marcos's request).
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Physics)]
[Tooltip("Controls a collider isTrigger Flag")]
public class SetIsTrigger : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(Collider))]
public FsmOwnerDefault gameObject;
[RequiredField]
public FsmBool isTrigger;
public override void Reset()
{
gameObject = null;
isTrigger = false;
}
public override void OnEnter()
{
DoSetIsTrigger();
Finish();
}
void DoSetIsTrigger()
{
GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null) return;
if (go.collider == null) return;
go.collider.isTrigger = isTrigger.Value;
}
}
}
Bye,
Jean
-
Hi,
Action is now on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) called "ColliderIsTrigger"
Bye,
Jean