playMaker

Author Topic: SetIsTrigger  (Read 3094 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
SetIsTrigger
« 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



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: SetIsTrigger
« Reply #1 on: April 27, 2015, 04:46:41 AM »
Hi,

Action is now on the Ecosystem called "ColliderIsTrigger"


 Bye,

 Jean