News Forums Search Search Results for 'stop moving'

Viewing 15 results - 16 through 30 (of 99 total)
  • Author
    Search Results
  • #38290

    Sigil
    Keymaster

    If the Move node is both moving towards and facing the same target you would start to see the warning once it reached its target, unless you stop the AI before it gets on top of the target. With the Basic Motor this is somewhat handled with the Close Enough distance, although if that is small enough you would likely see the same warning.

    Were you getting this warning when the facing target wasn’t set? If so, can you tell where it was coming from? I can’t recall if it shows up in the log or not.

    #38238

    prime
    Keymaster

    1) Constraints are a solution to question # 1:
    SELECTOR
    — CONSTRAINT (hp > threshold)
    —— Do behaviors other than flee
    — SEQUENCER
    —— EXPRESSION (hp < = threshold) ------ Flee behaviors 2) Use a Parallel to for the restore action. For example, you have a number of top level nodes that run all the time. You could add another that was the "restore" behavior: PARALLEL -- SEQUENCER (REPEAT FOREVER) ---- EXPRESSION (restore == true) ---- EXPRESSION (restore = false) ---- ACTION (increase HP until filled up) 3) Movement is not acceleration based. Sounds like you are running into an edge condition. You are probably moving into range and then stopping once you see that you are within range - that will be right on the very edge. If anything changes at all, you will be out of range again. Further, since movement has a "close enough distance" you are probably moving really close to within range but then stopping before you get there. Then restarting. Then stopping. The solution is to move well within range. If attack range is 10M, for example, then move within 8M.

    #38174

    Modulo35
    Participant

    Hello, i just starting to learn Rain,i follow a tutorial from a book to make the character wander around to different point around the navigation mesh.Here my Behavior Tree:

    So the Custom Action “Select Next Target” is a small script that find target around the navigation mesh,here the script:

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using RAIN.Action;
    using RAIN.Core;
    using RAIN.Navigation.Graph;
    using RAIN.Navigation;
    [RAINAction]
    public class SelectRandomTarget : RAINAction
    {
        public override void Start(RAIN.Core.AI ai)
        {
            base.Start(ai);
        }
        public override ActionResult Execute(RAIN.Core.AI ai)
        {
            var loc = Vector3.zero;
            List<RAINNavigationGraph> found  = new List<RAINNavigationGraph>();
            do
            {
                loc = ai.Kinematic.Position;
                loc.x += Random.Range(-8f,8f);
                loc.z += Random.Range(-8f,8f);
                found = NavigationManager.Instance.GraphsForPoints(
                    ai.Kinematic.Position,
                    loc,
                    ai.Motor.StepUpHeight,
                    NavigationManager.GraphType.Navmesh,
                    ((BasicNavigator)ai.Navigator).GraphTags);
            }
            while (Vector3.Distance(loc,ai.Kinematic.Position) < 2f
                || found.Count == 0);
            ai.WorkingMemory.SetItem<Vector3>("TargetPoint",loc);
            return ActionResult.SUCCESS;
        }
        public override void Stop(RAIN.Core.AI ai)
        {
            base.Stop(ai);
        }
    }

    The first parallel “walk to target”,is just a animate node with walk state and the move node have the field “Move target” set to “TargetPoint(from the script),move speed set to 1.

    The next parallel “Look Busy”,is just a animate node with a idle state and a timer to wait 2 second for the next target.

    My problem is that, my character start to walk,but when he go the target,normally he should stop(idle) for the 2 second,but he don’t do this,it seem to be trap in a loop and continue to walk without moving..

    Here i made a small video:

    Anyone know what i missing?

    Thank you

    • This topic was modified 7 months, 3 weeks ago by  Modulo35.
    • This topic was modified 7 months, 3 weeks ago by  Modulo35.

    rainuser123
    Participant

    Can I setup rain to avoid dynamic obstacles?

    I have a room with dynamic furniture in it that I would like my characters to avoid and I would like to know roughty the performance cost of doing this because there will be quite a few characters wandering around.

    Is there something like this:

    http://www.staff.science.uu.nl/~gerae101/motion_planning/dynamic_navmesh.html

    Second I have a one-way door that characters enter through. How can I ensure that if the character stop moving for a few seconds it will find another path or choose a new location. I have come across several situations where a character will try to reach a nav point but not quite be able to get there and so just stops pressed up against an object.

    #38126

    prime
    Keymaster

    On the Mecanim Motor issue - you had Use Root Motion checked. Your animations must play in order for the AI to move. These would need to be triggered through the Speed parameter your motor is passing to your state machine.

    For your shooting behavior:
    1) Don’t use close enough distance from the motors. That will cause movement problems. Instead, use a Visual Sensor with a radius of 9.
    2) Once the enemy is detected, you will need to trigger the firing behavior in UFPS. That probably means the AI will need to stop moving. If UFPS takes care of the rest, you are done. If not:
    3) You will need to
    - play a shooting animation
    - play shooting audio
    - send out your bullet projectiles (this at least would be from code)

    #37939

    prime
    Keymaster

    I’m confused about the scenario. I thought the issue was that the AI would stop moving between waypoints after it reaches a couple of them.

    I also don’t understand why Z axis matters for a facing target. Do you mean vertical?

    #37937

    alok@junesoftware
    Participant

    I have a Move node that has closeEnoughDistance = 3, so after reaching closeEnoughDistance AI returns Success and Stops moving. I have also added another move node with only FaceTarget but if the target moves in Z axis Ai doesn’t face the target until a large enough value, after which it turns. So for Shooting at a target it fails for small movements.

    #37936

    prime
    Keymaster

    Change your face before move angle to 360. That won’t stop the AI from looking at the enemy. If you want the AI to face the target before moving, then add a Move node with only a face target prior to the main move node. If you want the AI to face the target while moving, then add it as a FaceTarget in your move node.


    OnyxRook
    Participant

    Okay, I feel dumb. It seems to me that this should be an extremely obvious thing, but I’m just not getting it.

    So I’m trying to get an audio clip to repeat while the AI is moving, and stop once it gets to the next waypoint. Here’s my tree:

    tree

    The way it is right now, the audio plays once as soon as the AI leaves a waypoint. If the AI gets to the next waypoint before the audio is complete, it will wait until the end of the audio clip to implement the timer. Makes sense. How would I go about altering this to make it behave the way that I want?

    I want to play footstep sounds while the AI is moving, and have them stop when it stops.

    Thanks in advance, sorry for the thick-headedness.


    Alvyxaz
    Participant

    Hello,

    I’ve been playing with RAIN AI for a couple of hours now, however, it seems like I can’t move a body from within a custom action - it just doesn’t change it’s position.

    I know that moving an object with a fixed translate like that is not a proper way to move an object, but nevertheless, it should still work. I’ve tried logging position before and after translate, and it does change, however, once action is called again, it’s back at the same position it was before

    Does anyone know how to fix this or why is this happening?

    To localise the problem, I made the most trivial example:

    My tree view:
    Desc

    Action:

    [RAINAction]
    public class MoveToPlayerDirection : RAINAction
    {
        public override void Start(RAIN.Core.AI ai)
        {
            base.Start(ai);
        }
        public override ActionResult Execute(RAIN.Core.AI ai)
        {
            ai.Body.transform.Translate(100, 100, 100);
            return ActionResult.SUCCESS;
        }
        public override void Stop(RAIN.Core.AI ai)
        {
            base.Stop(ai);
        }
    }
    • This topic was modified 9 months ago by  Alvyxaz.
    #37614

    Sigil
    Keymaster

    For those of you who downloaded the project and tried it out, thanks! I’ll assume the general silence is a lack of problems (or disinterest I suppose).

    For the record, before release you will also see a few more things fixed:

    • Waypoint, sensor, and aspect editors all properly handle scale and what not when moving them
    • Waypoint, sensor, and aspect editors now hide the main tool handle when you have one selected so you don’t see multiple handles
    • Some additional options have been added/fixed on the Mecanim Motor, around TurnAngle/AngleToTarget/TurnBeforeMoveAngle
    • Fixed a bug in the Mecanim Animator states, where they wouldn’t properly set Stop variables, and in general were just not working as intended
    • Out of range exception on some pathfinding has been fixed.

    Thanks everyone, we should have a release out soon across most of our projects!

    I’ll still watch the thread if there are any last minute finds.

    #36699

    In reply to: Custom Physics Motor


    ArachnidJacob
    Participant

    I’ve tried manually doing that to all the ApplyMotion calls, but it still wont move.
    I’m convinced its RAIN stopping the original rigidbody from moving, as the behavior works fine, the engine speed gets set, particles start up, but no movement:

    I have all the movement behavior already in my agent, i just want to be able to use most of the builtin behavior tree tools that come with the package.

    • This reply was modified 10 months, 2 weeks ago by  ArachnidJacob. Reason: img wouldnt show, just dropping link

    bigfiregames
    Participant

    hi,

    I’m using the wander and flee behaviour tree and custom action in the rain starter kit.
    I generated a navmesh. the only thing I’ve changed is the navmesh size.
    my ai sometimes stops moving and the following error keeps coming into the console.

    Look rotation viewing vector is zero
    UnityEngine.Quaternion:LookRotation(Vector3)
    RAIN.Utility.MathUtils:GetLookAtVector(Vector3, Vector3)
    RAIN.Motion.MecanimMotor:Move()

    this happens with both the basic motor and the mecanim motor.
    the behaviour tree gets stuck on the move node which is showing as running.

    any ideas how to fix this?

    • This topic was modified 10 months, 2 weeks ago by  bigfiregames.
    #36639

    CodersExpo
    Participant

    Hey thanks to all of you for keeping up with this thread. I feel there is some real value to be had here.
    Special thanks to Yuewah Chan for getting us all pointed in the right direction and LordOfDuct for exploring the possibilities!

    I took your lead Yuewah, of moving to a target, and created a RAIN waypoint collection that we can patrolled around.

    To set up,

    1. Start a project and bring in the A* project package and RAIN package.
    2. Follow the instructions for setting up the A* project. (NOTE: in the YT vid where he starts writing his script to work with the seeker just stop.)
    * http://www.youtube.com/watch?feature=player_embedded&v=PUJSvd53v4k - YT vid setting up A*
    * http://arongranberg.com/astar/docs/getstarted.php - Aron A* project
    3. Once you have the A* project set up with a graph generated and your ground and obstacles defined…. Create a capsule character game object to act as our character. Select this character and add the RAIN AI Rig component.
    4. Select the child component ‘AI’ and click the ‘Navigation’ icon. In the dropdown select the AstarNavigator script.
    (MY MODIFIED VERSION OF THE CODE IS PROVIDED BELOW. SAVE THIS TO YOUR ASSETS FOLDER NAMED AstarNavigator.cs)
    5. Just below the AI Rig drag and drop on the AstarAIPath script.
    (MY MODIFIED VERSION OF THE CODE IS PROVIDED BELOW. SAVE THIS TO YOUR ASSETS FOLDER NAMED AstarAIPath.cs)
    6. This should have included the Seeker.cs. You should now have below the RAIN AI Rig the AstarAIPath and Seeker scripts.
    7. Now create a RAIN waypoint set. Add several waypoints and name the waypoint set. Enter the same name of this waypoint set in the AstarAIPath script variable ‘Way Point Route Name’ found below the AI Rig component in the inspector.
    8. Next create a behavior tree. Assign this new behavior tree to your AI character.
    The Behavior tree in this example is simple:
    Root
    ….SEQ
    ……..WAY (Node Type=Patrol, Repeat=Never, Waypoint Route=”Waypoint Route” (Note this is the same name to add in our AstarAIPath as defined above), Loop forward, Move Target Varriable = varNextPoint
    ………….MOVE Move Target = varNextPoint
    9. Again, make sure this behavior tree is assigned to the AI Rig Mind

    You should be able to run this and watch your dude move from waypoint to waypoint.

    ********Scripts follow in the next few threads due to length restrictions************
    Copy save the first
    The second script had to be split in two posts. Just follow the instructions.

    • This reply was modified 10 months, 2 weeks ago by  CodersExpo.
    • This reply was modified 10 months, 2 weeks ago by  CodersExpo.
    #36521

    javurtez
    Participant

    Also any idea how to know if my character stops moving / reach a certain location using nav target so that the AI knows and ends the turn?

    Can’t edit my post somehow.

Viewing 15 results - 16 through 30 (of 99 total)