LookAt Behavior Doesn't Support SphereCast Detection


New member
I'm using the UCC (v 2.4.8) and trying to get the LookAt character behavior to work with the SphereCast detection option.

It looks like the only detection mode for LookAt that currently works is Trigger based. Is there a supported way to get LookAt to use SphereCast? It's possible to configure the behavior this way, but it does nothing.

I made a hacky change in LookAt.cs (@ line 95) adding:

closestObject ??= m_DetectedObject;

which sort of seems to work (although the character continues to look at the target for a while after leaving the detection radius). Is there a better way to accomplish this short of writing my own custom implementation of LookAt? It's odd for LookAt to support these options as configuration, but not respect them at runtime.



Staff member
The LookAt ability inherits from the DetectObjectAbilityBase class and does not provide any separate functionality to detect an object. So I recommend that you put a break point in the CanStartAbility() method of the DetectObjectAbilityBase class and see why your cast is not succesfull.