Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on May 10, 2011, 02:45:25 AM

Title: SetIsTrigger
Post 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).

Code: [Select]
// (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


Title: Re: SetIsTrigger
Post by: jeanfabre on April 27, 2015, 04:46:41 AM
Hi,

Action is now on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) called "ColliderIsTrigger"


 Bye,

 Jean