Setting Target game object reference on RotateTowards action doesn't work (Movement Pack & Tactical Pack)

Krusty

New member
Hi there,

I recently purchased Behavior Designer Pro and was trying to use the RotateTowards action. I created a stacked action that is first using "Seek" with AStarAI pathfinding and then is supposed to rotate the character using "RotateTowards" once it reaches its destination. But it doesn't rotate, specifically if I try to get it to rotate using the Target game object reference. It works if I manually set the TargetRotation, but that defeats the purpose of having it rotate using the Target game object's transform.

Seek: has UpdateRotation set to true and "Destination_PerformingPlatform" set as its Target. This works and the character moves over the Recast Graph to get to its destination, but doesn't rotate the character to match "Destination_PerformingPlatform"'s rotation.

then

RotateTowards: has use2DPhysics set to false, maxRotationDelta set to 1 (default), arrivedAngle set to 0.5 (default), onlyY is set to true, and Target is set to "Destination_PerformingPlatform" (same as Seek). ""Destination_PerformingPlatform"'s transform rotation is set to (0, -90, 0). When character reaches the destination it doesn't rotate to -90 in Y, but it checks it as being successful in the Behavior Designer editor window. I have also tried unchecking the onlyY boolean value and increasing the maxRotationDelta to 180, but that didn't allow the character to rotate either.

Am I missing something or did I just find a bug? I'll attach some screenshots. Thanks!

- Krusty
 

Attachments

  • BehaviorDesignerPro_RotationToUse.png
    BehaviorDesignerPro_RotationToUse.png
    92 KB · Views: 4
  • BehaviorDesignerPro_RotateTowardsMovementPackNotWorking.png
    BehaviorDesignerPro_RotateTowardsMovementPackNotWorking.png
    221.9 KB · Views: 4
I forgot to mention which versions of each package I'm using. I'll attach another screenshot showing the downloaded versions in the Package Manager. Let me know if you need anymore details.

-Krusty
 

Attachments

  • BehaviorDesignerAndA*Paths_Versions.png
    BehaviorDesignerAndA*Paths_Versions.png
    25.5 KB · Views: 3
Hi Krusty,

The Movement Pack's RotateTowards uses the Target GameObject's position to determine which direction to face; it doesn't copy that object's rotation.

Since Seek moves the character to the same target position, there may be no remaining direction to face when RotateTowards starts. That would explain why it returns Success without rotating to -90 degrees.

If you want the character to match the destination's orientation, use TargetRotation. If you want it to face another object, set Target to a separate object positioned in the desired facing direction.

There could also be another component controlling rotation. As a separate check, temporarily disable A*'s rotation updates while RotateTowards runs, with its Target positioned away from the character. Does it turn correctly in that setup?
 
Thank you, I will use the TargetRotation field instead then.

I was hoping that I could reuse the same target game object (as Seek used). So that if I moved the location and rotation of the target, I wouldn't have to create a brand new target rotation game object or change the hard coded value of TargetRotation. It's not a big deal, but it does make you have to set up 2 separate pieces instead of just being able to use the target game object's position and rotation for both the NPC's destination position and rotation.
 
Back
Top