News › Forums › RAIN › General Discussion and Troubleshooting › How to get the next point on a path
Tagged: Nodes, waypoint transform
This topic contains 6 replies, has 2 voices, and was last updated by frecio231 1 month, 1 week ago.
December 28, 2022 at 6:07 pm #34928
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 lotDecember 30, 2022 at 3:47 pm #34939
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.December 31, 2022 at 6:18 pm #34954
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#January 3, 2023 at 6:57 am #34972
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.January 4, 2023 at 9:42 pm #34984
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.January 6, 2023 at 9:13 am #34994
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).January 11, 2023 at 10:42 pm #35054
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.
You must be logged in to reply to this topic.