Forum rules - please read before posting.

A* pathfinding rotation solution.

Hey everyone, I've implemented A* with Adventure creator and it works great except for rotations. Both AC and A* have ways to control the charactes rotation wich ends in the character being rotated by both and just glitching out. Is there a way to make AC work only with A* rotations? Or the other way around?

Comments

  • A* itself is just a pathfinding algorithm - are you referring to a specific asset, e.g. A* Pathfinding Project?

    It would be best to have either AC or A* control both the character's position and rotation - which is being used to control position at the moment? If it's not possible to amend A* itself to not control rotation, you can prevent AC from having any effect on the character's transform by setting the character's Motion control field to Manual.

  • edited December 2022

    I'm using A* pathfinding pro by Aron Granberg. I've seen a method that handles the rotation, and I could make an override for it. But looking into the AC scripts, I'm not sure how AC handles the rotations to use them in the override. What would you say is the recomended way of handling AC rotations on external scripts and keep charactes motion control in automatic?

    Edit: I used a simple solution for this A* asset I found in the forums. I belive is this one.

  • If you want to get the rotation that AC "wants" the character to be, you can do so by accessing the character's GetTargetRotation() function.

    If the character's Motion control is Automatic, though, this'll be applied automatically. If you wanted to mix both AC and A* rotations, you'd probably be looking at setting it to Manual, and then hacking A* to refer to its own rotation values when pathfinding, and GetTargetRotation otherwise.

  • Hey! I'm trying to get this to work with a Character: Walk to point action with Copy marker angle. I tried using the GetTargetRotation(), and it mostly works. But A* has an End Reached Distance to determine if the character has reached the point and stop moving. This means the character doesn't necessarily reach the exact point. So I can use A*'s reachedDestination in an if statement to call AC's GetTargetRotation(). But since the character hasn't actually reached the marker, GetTargetRotation() won't return the marker's rotation. Is there a way for me to "force" AC to return the marker's rotation?

  • If you call EndPath on the AC Character once A* has decided they've reached the end - that should cause the Action itself to force the character to face the Marker.

    Even if you're opting to rely on A* for turning, this should still affect GetTargetRotation (and trigger the OnSetLookDirection custom event).

    Otherwise, you'd probably have to read the Marker Transform's forward-vector directly - and/or use a modified copy of the ActionPathfind script to connect A* more directly.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.