Is there an easy way to get DetectObjectAbilityBase actions to make character turn towards detected?

AKB

Member
I've made my own DetectObjectAbilityBase derived action and I'd like to know if there's a simple way to get the player to rotate and face the target before the action happens or do I have to do that manually (Ideally I want a hand of the character to face it, if possible)? If the latter how can I chain that, so it's can call me back once the character has finished rotating and I can continue with the action.

NOTE: We don't have IK as we don't have a humanoid, just generic avatar.
 
DetectObjectAbilityBase is just responsible for detecting objects that it can interact with, not for moving the character. There is the Move Towards ability that helps with movement/rotation.
 
Hi.

I understand my ability won't do that and maybe it was a red herring to mention DetectObjectAbilityBase (I need my custom ability to be dependent on detecting something), but how would I then get my character to turn towards (NOTE, not Move Towards) it first, before performing the main code of my custom ability? Basically, what would be the recommended way of adding sequenced Turn Towards functionality to custom abilities?
 
Last edited:
The MoveTowards ability does actually rotate the character too. You can simply rotate the transform of the target MoveTowardsLocation object, and the character will rotate to match it after reaching its position (check the MoveTowardsLocation gizmo in the scene view to see the target direction - you can modify the Yaw Offset value to also add an additional rotational offset from its transform rotation). So you could simply have the "Independent Move Towards Location" of the MoveTowards ability set to a custom MoveTowardsLocation transform (e.g. one that's a child of the character object), which you can simply rotate to match whatever direction you want the character to face. You can then wait for the MoveTowards ability to end before continuing with whatever logic you need to do next. This is how the Interact ability is set up in the demo scene, e.g. check out the Interact button in the interactions room - it sounds like your use case may be able to make use of Interact.
 
Top