News Forums RAIN General Discussion and Troubleshooting How to get the next point on a path

This topic contains 6 replies, has 2 voices, and was last updated by  frecio231 1 month, 1 week ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #34928

    frecio231
    Participant

    Hello I want to know how in a script i can get the information about the next waypoint and using. The information I want is the transform of the next waypoint and know how I can get the information of the current state of the patrol I mean the current node on the AI. I don’t know if is possible but thanks a lot

    #34939

    prime
    Keymaster

    Waypoints don’t have transforms - they aren’t Unity game objects. However, when using a Waypoint node in the BT, the move target is always set to what would be the transform of the next waypoint.

    #34954

    frecio231
    Participant

    ok and in code how i know if I reached a node and how to know the vector 3 of the next
    pd. I’m using c#

    #34972

    prime
    Keymaster

    The Motors in RAIN support an IsAt(Vector3) call to let you know if you are at a position (from a pathfinding/reachability perspective). If you just want to know if you are at a certain position, you can use that.

    To access waypoint information from code, you can get a list of waypoints from any WaypointSet. WaypointSets are associated with WaypointRigs. So, if you know which WaypointRig you are interested in, you can get individual waypoint data.

    If you are trying to get the status of a parent waypoint node from a custom action in the behavior tree, that isn’t easy to do. Behavior Tree Nodes don’t have references to their parent nodes and the setup wasn’t intended to let the actions within a waypoint node query the path. We’re looking into make some changes to the waypoint setup to give you more access to individual waypoints and the waypoint path, but those changes aren’t in yet.

    What’s the use case? What are you trying to accomplish? Maybe we can suggest a workaround.

    #34984

    frecio231
    Participant

    Well first of all, thanks you are the best!!
    Second I’m triying to get the information of the position to be able to know what speed of rotation must have the character, so if I got a point in some position I can know the exact velocity of the rotation, but if this is to hard to do I only want to know the rotation speed equivalency (to know if this guy must turn and activate the respective parameter in the character controller animator.

    #34994

    prime
    Keymaster

    Let me make sure I understand. You reach a waypoint and then you want to calculate the rotation angle between the AI and the next waypoint?

    If so, you could write a custom action that occurs as the first child of a Waypoint Node in the behavior tree. Then you would simply calculate the angle between the AI.Body.Forward and the direction vector from the AI.Body to the next waypoint target (move target).

    #35054

    frecio231
    Participant

    Ok, I’ll try this, unfortunately I have to format my HDD so I must to re-install unity and download it. Thanks a lot for the support.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.