Topic: Keyboard override?
Eg. press X and all agents stop moving for X seconds, or run away from a set agent?
Any ideas on where to start?
I’m having an issue where the AI seems to ignore the close enough distance in the move action as well as in the motor controller. This seems to happen if the move action is in a node that repeats. I setup a basic bt as follows:
Para (fail any, succeed all ) Detect ( repeat forever ) Select ( repeat never ) constraint ( target != null, repeat never ) move ( close enough distance = 10, repeat never ) expression ( test = 1, return success )
This works and the ai moves to the target and stops 10 units away. If however I change the Parallel to (fail any, success any), the AI moves all the way to the target. The move does return true for one frame but on the next frame it resumes running and moves all the way to the target before stopping and returning true. The expression is used for debugging and setting a breakpoint there shows the move does return true for one frame before resuming on the next frame an attempting to move all the way to the target.
It seems like when the move first returns true, the tree resets and the move then begins executing again ignoring the fact that it’s close enough.
I’ve found that setting the select to repeat as well as the constraint to repeat also causes the move to attempt to move past the close enough distance. It seems to be related to move not behaving well when it’s in a repeating node.
One other thing I’ve noted is when the target’s collision mesh is enabled, the ai moves up to where it collides and doesn’t move further. When the target’s collision mesh is disabled, it moves all the way to the target’s center. In both cases, move doesn’t return true until about a quarter second after it stops moving. It’s like it keeps trying to move and only returns true after it can no longer move for a few frames.
Is this a bug or am I doing something wrong?
- This topic was modified 2 months, 3 weeks ago by Sigil. Reason: added code block
I have been experimenting around with RAIN AI for a while now. I created a very simple chasing AI behaviour and then set it aside while I worked on other things. When I came back to it and copied my enemy it no longer worked.
It calculates a path but doesn’t follow it. It seems like it gets stuck each time it tries to cross one of the navigation mesh polygons. If I toggle on and off the Allow 3D Movement box it will continue to move most of the time, otherwise it doesn’t do anything.
It also no longer rotates to face my player. I am really confused as to what I broke, but even placing a new behaviour tree (The one from the tutorial video) does nothing to fix it. It still cannot navigate the mesh.
Does anyone have any suggestions? I was really starting to like this solution but now I’m on the verge of chucking it out.
- This topic was modified 3 months, 1 week ago by Riscvul.
Yesterday I downloaded Rain AI and have been looking at some tutorials on youtube. After following a tutorial, I should have an AI that patrols and chases the player if the player gets detected.
The problem that I encountered is the following:
I’m using an first person controller script and it’s using the unity character controller (the script is from the asset store. I added an entity as a child of this player object. But when I move, the entity object does not move along with the player object. The entity object stays on the starting position of the player object while the player just moves around the scene. So what happens is: if the AI patrols and finds the entity, it moves towards the entity of the player. The ai stops moving afterwards because he is still detecting the entity. But.. the actual player object is somewhere else.
I tried to check what happened if I made an object in another scene and adding an entity + rigidbody. In that scene, the entity does follow the player and the ai will work like it should behave.
Anyone that can point out what I’m missing to make the entity move along with the character controller object?
Currently I have AI sliding while they’re attacking is there a good way to make the AI stay in place during the attack animation?
Been trying to create a simple traffic system using RAIN AI.
I plan to make cars travel along a set of waypoints that I intend to use as the “road”.
I also wanted it so that they stop when they detect another car in front of them
However, I’ve been having problems trying to get the AI to continue moving to the next waypoint.
Somehow when they are less than halfway through to the next waypoint and they are interrupted
by the car in front, they return to their previous waypoint. When they are more than halfway
through, they skip the current waypoint and moves to the next.
I’m having a hard time looking for more information in the wiki and would like some help.
Thanks in advance!
Here is a gif depicting my problem.
Here is a picture of the behavior tree I used.
Here is the XML export of my Behavior Tree.
<behaviortree version="1.1" repeatuntil="" name="Car2BT" debugbreak="False"> <sequencer usepriorities="False" repeatuntil="" name="root" debugbreak="False"> <parallel tiebreaker="fail" succeed="all" repeatuntil="" priority="" name="parallel" fail="any" debugbreak="False"> <detect sensor=""Car Sensor"" repeatuntil="running" name="detect car" matchtype="best" entityobjectvariable="frontCarForm" debugbreak="False" consistent="True" aspectvariable="frontCarAspect" aspectobjectvariable="frontCarMountPoint" aspect=""Car"" /> <waypointpatrol waypointsetvariable=""TrafficPath"" waypointactiontype="patrol" traversetype="loop" traverseorder="forward" repeatuntil="" pathtargetvariable="" name="waypointpatrol" movetargetvariable="moveTarget" debugbreak="False"> <selector usepriorities="False" repeatuntil="" name="selector" debugbreak="False"> <constraint repeatuntil="" priority="" name="stop - car detected" debugbreak="False" constraint="frontCarAspect != null" /> <constraint repeatuntil="" priority="" name="move - no car detected" debugbreak="False" constraint="frontCarAspect == null"> <move turnspeed="" repeatuntil="" name="move" movetarget="moveTarget" movespeed="10" facetarget="" debugbreak="False" closeenoughdistance="" closeenoughangle="" /> </constraint> </selector> </waypointpatrol> </parallel> </sequencer> </behaviortree>