I am back to the collision (been using the old PM 1.4 for testing)
I had some issues way back when 1.4.4 came out, I am not entirely sure I have resolved them 100% but I am making progress.
one problem I am having with a custom script that was working before was a script listening to all 3 types of trigger events (edited the triggerEvent)
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.
using System;
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Physics)]
[Tooltip("Detect collisions with objects that have RigidBody components. \nNOTE: The system events, TRIGGER ENTER, TRIGGER STAY, and TRIGGER EXIT are sent when any object collides with the trigger. Use this action to filter collisions by Tag.")]
public class TriggerCount : FsmStateAction
{
// public TriggerType trigger;
[UIHint(UIHint.Tag)]
public FsmString collideTag;
// public FsmEvent sendEvent;
public FsmInt collideCount;
// public FsmInt maxCollide;
public FsmBool collidedBool;
public bool everyFrame;
public override void Reset()
{
// trigger = TriggerType.OnTriggerEnter;
collideTag = "Untagged";
// sendEvent = null;
collideCount = null;
collidedBool = null;
everyFrame = false;
}
public override void OnEnter()
{
if (!everyFrame)
Finish();
}
public override void DoTriggerEnter(Collider other)
{
if (other.gameObject.tag == collideTag.Value)
{
collideCount.Value = collideCount.Value + 1;
}
}
public override void DoTriggerExit(Collider other)
{
if (other.gameObject.tag == collideTag.Value)
{
collideCount.Value = collideCount.Value - 1;
}
}
public override void OnUpdate()
{
if (collideCount.Value == 0 )
{
collidedBool.Value = false;
}
else
{
collidedBool.Value = true;
}
}
// public override string ErrorCheck()
// {
// return ActionHelpers.CheckOwnerPhysicsSetup(Owner);
// }
}
}
the issue is with the update, from what I gather, it only can do one type per script?
public override void Awake()
{
switch (trigger)
{
case TriggerType.OnTriggerEnter:
Fsm.HandleTriggerEnter = true;
break;
case TriggerType.OnTriggerStay:
Fsm.HandleTriggerStay = true;
break;
case TriggerType.OnTriggerExit:
Fsm.HandleTriggerExit = true;
break;
}
}
my version, based on the old system only records enters now and not exits (I dont test for stays) is this the case or am I wrong, is there a fix? or do I have to have 2 separate actions, if so is there a chance that it could miss an event if 2 actions are used?