Ando5000
Member
Working on a basic stealth ability. Currently im using the basic crouch (height change) ability and a large sphere collider that is set to not collide with anything but another sphere collider placed on the enemy. when the player gets to close they will be discovered by a trigger and fire a script on the player. I would like it to stop the crouch ability on trigger enter.
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Enemy")
{
var characterLocomotion = m_Character.GetComponent<UltimateCharacterLocomotion>();
var sneakAbility = characterLocomotion.GetAbility<HeightChange>();
characterLocomotion.TryStopAbility(sneakAbility, true);
Debug.Log("caught me, sneak failed");
}
}
Debug.Log Fires, but Crouch ability continues. I attempted to debug this in the TryStopAbility() method and the log says crawl is not active. I assume both crawl and crouch are using the same ability? How do i force it to return to the standing state?
Log:
not activeOpsive.UltimateCharacterController.AddOns.Agility.Crawl
UnityEngine.Debug:Log(Object)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStopAbility(Ability, Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1406)
StealthDetection:OnTriggerEnter(Collider) (at Assets/StealthDetection.cs:22)
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Enemy")
{
var characterLocomotion = m_Character.GetComponent<UltimateCharacterLocomotion>();
var sneakAbility = characterLocomotion.GetAbility<HeightChange>();
characterLocomotion.TryStopAbility(sneakAbility, true);
Debug.Log("caught me, sneak failed");
}
}
Debug.Log Fires, but Crouch ability continues. I attempted to debug this in the TryStopAbility() method and the log says crawl is not active. I assume both crawl and crouch are using the same ability? How do i force it to return to the standing state?
Log:
not activeOpsive.UltimateCharacterController.AddOns.Agility.Crawl
UnityEngine.Debug:Log(Object)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStopAbility(Ability, Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1406)
StealthDetection:OnTriggerEnter(Collider) (at Assets/StealthDetection.cs:22)