News Forums RAIN General Discussion and Troubleshooting how to stop the AI movement?

This topic contains 12 replies, has 2 voices, and was last updated by  prime 2 years ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #6152

    Yuewah Chan
    Participant

    In rain 1.x, I can set RainAgent.maxSpeed = 0; RainAgent.maxRotationRate = 0; to stop AI movement during Move Node.
    But In rain 2.0.8, AiRig.AI.Motor.Speed = 0; AiRig.AI.Motor.RotationSpeed = 0; doesn’t work.

    #6153

    prime
    Keymaster

    Can you be more specific? I just ran a few tests and it seems to work fine for me.

    #6158

    Yuewah Chan
    Participant

    btw, I am using my custom navgiator class which only return next waypoint, is there anything I need to implement?
    I will try to use the RainNavgiator to test again.

    #6162

    prime
    Keymaster

    Shouldn’t matter. The Motor controls movement speed. The Navigator only provides move targets. Note that setting a Default Movement Speed will not limit your motion. In RAIN Indie the value was a Max (limiter). There is no equivalent in RAIN. If your code or your BT Move node specifies a different speed, that’s what will be used.

    #6164

    Yuewah Chan
    Participant

    how can my code change the speed of AI.Motor ?

    void OnGUI()
    {
    if ( GUI.Button(new Rect(0,0,50,50), “Stop”) )
    {
    aiRig.AI.Motor.Speed = 0;
    }
    }

    However, the aiRig.AI.Motor.Speed become 1 in the next frame.

    #6165

    prime
    Keymaster

    Are you running a behavior tree that is Moving the AI at a speed of 1? Is some other code changing it? Unless the AI is being reset, the default value is not re-applied.

    #6174

    Yuewah Chan
    Participant

    the speed is not set on Move Node.

    I am using rain 2.0.8 ( fresh update from 2.0.5 ) + Unity 4.3.1

    BT:
    root
    |-timer ( 3 sec )
    |-get random target ( set variable “movetarget” to random position ) )
    |-move ( Move Target: movetarget )

    AIRig use all Basic Components( BasicMemory, BasicMind, BasicMotor, BasicNavigator etc )

    The following link is my test project
    https://dl.dropboxusercontent.com/u/9322397/RAIN/Test2.0.8.zip

    #6182

    prime
    Keymaster

    Right… Sorry, I didn’t give the correct information about how movement speed works.

    If you are using a Behavior Tree Move node, the node will determine move speed in the following way:

    - If the move speed field is left blank, then the default AI speed is used
    - If the move speed field is invalid (bad expression, etc.) then the default AI speed is used
    - If the move speed field has a valid value (constant, calculated expression, or variable) then the field value is used.

    In your case, use a variable in your BT move node for speed. Then stop the AI by setting that variable to 0.

    #6183

    prime
    Keymaster

    By “default AI speed” I mean the Motor Default Speed.

    #6205

    Yuewah Chan
    Participant

    Why don’t rain2.x not having MaxSpeed or MaxRotation like rain1.x, what you suggested in last post is quite time consuming that all move node in all BT need to assign a variable.

    #6243

    prime
    Keymaster

    You don’t have to assign a variable. If you assign nothing, it uses default speed. If that isn’t what you want, then of course you have to tell RAIN what you do want…

    #6278

    Yuewah Chan
    Participant

    Default speed cannot be changed during runtime, what I want is having MaxSpeed and MaxRotation in rain 2.x

    #6280

    prime
    Keymaster

    Default speed can be changed at runtime.

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

You must be logged in to reply to this topic.