navAgent.SetDestination(pos) does not rotate when a Behavior Tree component is active

Hyrad

New member
I have a first component a navmesh agent destination is set and updated. If I add a BehaviorTree component to the same gameObject with a simple composite sequence, the unit will still move but will not rotate towards its next target vector, even if I set the transform rotation manually in the first component's update. The only thing that will work is transform.LookAt, but this is far from smooth.

I gather that Behavior designer is overriding the navAgent in the first component, but I can't figure out where. If I disable the BehaviorTree component it starts working again. I have looked at the tasks code and haven't found what could be the problem since I am not rotating or moving the object through tasks. Do you have any pointers of where I should be looking to solve this?

This is a simple RTS game where the user points and clicks on a destination to move the unit, which is handled by simple navmesh code. When certain sharedProperties are updated and evaluated, the idea is for Behavior designer to kick in and handle the unit fleeing from battle without player intervention.


Thanks,
Jeff
 
The Movement Pack does set the rotation - are you using that? Within each Movement Pack task there is an option to update the rotation or not.
 
I have a first component a navmesh agent destination is set and updated. If I add a BehaviorTree component to the same gameObject with a simple composite sequence, the unit will still move but will not rotate towards its next target vector, even if I set the transform rotation manually in the first component's update. The only thing that will work is transform.LookAt, but this is far from smooth.

I gather that Behavior designer is overriding the navAgent in the first component, but I can't figure out where. If I disable the BehaviorTree component it starts working again. I have looked at the tasks code and haven't found what could be the problem since I am not rotating or moving the object through tasks. Do you have any pointers of where I should be looking to solve this?

This is a simple RTS game where the user points and clicks on a destination to move the unit, which is handled by simple navmesh code. When certain sharedProperties are updated and evaluated, the idea is for Behavior designer to kick in and handle the unit fleeing from battle without player intervention.


Thanks,
Jeff
Thanks for the answer. I decided to start from scratch and manage all of the AI through BD. I will check into the update rotation option and report back if I still have the issue.
 
Top