News Forums RAIN General Discussion and Troubleshooting Waypoint Patrol Loop Not working?

Tagged: 

This topic contains 14 replies, has 6 voices, and was last updated by  Gobias 1 year, 8 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #4622

    justinliebregts
    Participant

    I’ve set up my project exactly the same as the Getting Started with RAIN tutorial that was just released for the new RAIN. However when my character controller gets to the first way point node it just stands there not moving. What am I doing wrong? The Loop Type is set to Ping Pong, the move target is defined and the character is moving to the first waypoint so I know the move code is working. I also have the root node in my BT as a parallel node type.

    Here is my project to download if you want to check my setup: http://www.ubiqvisuals.com/media/Rain.zip

    Thanks,
    Justin

    ps - I recommend having the ability to upload files into this forum because if I am to start including images or links to downloads, if those links or images get moved, then your forum will have questions with missing images and links and it makes it less of a useful resource for people who come here for answers in the future.

    #4632

    joshb
    Participant

    I believe the issue is the registration point on the AI’s GameObject.
    You need to move it to the base of the GameObject.
    I did this by wrapping an empty GameObject around the AI and Mesh.
    If you look closely at the tutorial you can see that’s how it’s done even though its not gone over.
    Here is an example project I created using Capsules.

    https://www.dropbox.com/s/61w9wlytqzz04if/AIChase_Rain_2.rar

    #4638

    prime
    Keymaster

    Hey Justin -

    Your project zip file is missing the Library folder, so all the objects in the scene are unlinked and I can’t test it.

    However, I suspect @joshb is right. The transform location of your AI is the midpoint of the capsule, not the base. The AI is probably getting stuck because it doesn’t think it is close enough to the Waypoint (essentially, the distance from the midpoint to the ground is greater than both close enough distance and step up height).

    Wrapping your object in a parent object is usually the right thing to do. This allows you to point the AI at the parent object, and then adjust the location of your “physical body” - in your case a capsule - so that when the parent object is on the ground, the physical body looks correct. (and so I don’t confuse anyone with the term “physical body”, the AI Body would still be pointed to the parent object).

    Hope that makes sense.

    #4688

    Nicco
    Participant

    Same problem here. I did as instructed, wrapping the AI and mesh in an empty GameObject. Still had the same issue.

    Here’s the project: https://dl.dropboxusercontent.com/u/6489978/rwhertjrwtjwrtynmdstnmtrs/RAINTesting001.zip

    • This reply was modified 1 year, 8 months ago by  Nicco.
    #4693

    prime
    Keymaster

    Your AI Body is set to WhiteRobot_Body. Switch that to the parent object WhiteRobot and you’ll be in business.

    #4696

    Nicco
    Participant

    D-oh! That’s it! Thanks for the help.

    #4719

    shiba_nivengo
    Participant

    I believe the issue is the registration point on the AI’s GameObject.
    You need to move it to the base of the GameObject.
    I did this by wrapping an empty GameObject around the AI and Mesh.
    If you look closely at the tutorial you can see that’s how it’s done even though its not gone over.
    Here is an example project I created using Capsules.
    https://www.dropbox.com/s/61w9wlytqzz04if/AIChase_Rain_2.rar

    I was having the same problem. joshb’s suggestion worked perfectly. Thanks!

    #5056

    Gobias
    Participant

    I’ve had the same problem. I set up a basic scene with two waypoints and a capsule. The capsule would walk to the first waypoint and stop. It is set up as told:

    Player (empty)
    - AI
    - Capsule

    However I can get it two work if I select the empty parent, and move it down -0.75, and the select the capsule mesh, and then move that back up +0.75. But that just doesn’t seem like the right way? But is that the inteded way?

    If I’m missing anything, I’m sorry. Unity and all this is still very new to me. RAIN as a tool seems like it will do wonders for out project. So thanks in advance.

    #5057

    justinliebregts
    Participant

    The main thing to double check is where your AI node is relative to the ground. Make sure the AI is sitting on the ground. Do do this, the best way is probably to have your empty Parent object’s pivot on the ground, then move the Capsule up (like you did). Now you should have a parent object whose pivot is on the ground, and the bottom of your nested capsule is resting along the ground as well. Then set your AI node to 0,0,0 and it will snap it to the ground since your player’s pivot is on the ground. Make sure you have your Gizmo set to Pivot and not Center (this will help you determine where the pivot actually is). This is on the top left of the Unity interface beside the move, rotate, and scale tools.

    #5065

    prime
    Keymaster

    To clarify - make sure your AI Body is sitting on the ground.

    This has caused enough issues for people, we may consider adding an offset for the motor so you can position the AI motion relative to the Body and solve the problem without having to change your hierarchy.

    #5066

    Gobias
    Participant

    Okay thank you for that answer. It gave me some understanding, especially the part about changing the Gizmo from center to pivot. I’m not exactly sure what the “AI node” is though.

    Yes that might be a possibility to implements a compensation for it. It sure confused us. But finding this thread gave some pointers on how to get it to work.

    • This reply was modified 1 year, 8 months ago by  Gobias.
    #5067

    justinliebregts
    Participant

    “AI node” is the AI GameObject inside your Player (empty) Gameobject.

    #5069

    Gobias
    Participant

    My AI Node then, stays at 0, 0, 0 dispite of any movement of the parent object.

    #5070

    justinliebregts
    Participant

    That’s because the position is showing it’s relative position to the parent. It doesn’t mean it’s in 0,0,0 world co-ordinates. It’s 0,0,0 relative to the parent pivot.

    #5071

    Gobias
    Participant

    When I select my AI node, there is no visual representation of the position of it. If I try to change its values, it has no effect, so I guess it is forever depentent on it’s parent? This is just minor details at this point I think, as it is currently working. Thanks for the fast responses btw.

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

You must be logged in to reply to this topic.