News Forums RAIN General Discussion and Troubleshooting Character doesn't move and "Look rotation viewing vector is zero"

This topic contains 10 replies, has 2 voices, and was last updated by  fxk 1 year, 8 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #4589


    I’m attempting to duplicate the teddy bear/maze animation described in the YouTube tutorial for Rain{Indie} with the new version of Rain. I’ve tried a couple of different things. I’ve tried to upgrade the teddy bear project from Indie to Rain and I’ve also tried to get a working AI starting from scratch with the newest Rain.

    In both case, my character remains in the Idle state (looking at the Animator window) and never moves. In both cases (upgrade and starting from scratch) console gives me the message “Look rotation viewing vector is zero.” The stack trace is:
    Look rotation viewing vector is zero
    RAIN.Utility.MathUtils:GetLookAtVector(Kinematic, Kinematic)

    I’m not sure if this message is at all relevant, but it’s my only clue so far.

    A brief overview of my AI set-up is:
    Memory - BasicMemory
    Mind - BasicMind with a behavior tree with 4 nodes (move to vector target + 3 set param nodes for Direction, Speed, AngularSpeed)
    Animation - MecanimAnimator with the Animator set to the character containing the AI (I tried unsuccessfully to set the Animator to be the actual Animator Controller that is a sub-component of the character)
    Navigation - BasicNavigator
    Perception - BasicSenses (no sensors)

    If any one has any insight as to why things might not be working, I’d be extremely grateful. Obviously, I can provide more information about my setup.

    Thanks in advance,



    Hmm. Are you using a Mecanim Motor as well?



    I’ve tried it with both a MecanimMotor and BasicMotor, still with no movement from the character.



    OK - I’ll grab the RAIN{indie} sample project from our website and go through upgrading it. I’ll let you know what I needed to do to get it running once I’m done.



    That would be great! Thanks so much.

    And thanks for the videos you’ve done. I’ve watched the one on upgrading as well as the just released one and they’re both well done and extremely helpful.



    Ok. I got this working. Here are the steps I took:

    1) Downloaded the Mecanim sample project from the RAIN{indie} support site (
    2) Opened the project in Unity 4.2.2
    3) Downloaded and imported the RAINIndie_1.3.4_to_RAIN_2.0.5.unitypackage from our download page
    4) After importing, chose RAIN->Upgrade from the menu and went through the upgrade process.
    5) Fixed the script errors as described in the upgrade tutorial (took 2 min.)
    6) Changed the Walkable Radius of the Recast NavMesh to 0.1 and then generated the navmesh. I did this after generating the navmesh a few times and noticing that there were gaps in the maze.
    7) Changed the AI Motor to MecanimMotor, and the AI Animator to MecanimAnimator
    8) Set the Mecanim Parameters on the Mecanim Motor:
    — Param Speed set to Speed
    — Param Rotation Speed set to AngularSpeed
    — Param Turn Angle set to Direction
    9) Opened the behavior tree. changed the move speed on the Move node to 1
    10) After playing with the parameters a bit, changed these settings on the MecanimMotor:
    — Default Rotation Speed = 90
    — Default Close Enough Angle = 20
    — Default Face Before Move Angle = 180

    Then hit Play. Should be working. Let me know if that works for you.



    I should mention, I did this on the RAIN Move Example scene.



    Thanks. I followed your instructions and that works really well. I did have one issue.

    I played around with the walkable radius for the NavMesh and found, like you, that for values much above 0.1, it wouldn’t work and the teddy stayed still. At 0.1, however, the teddy walks right through the edge of many of the crates. I tried tagging a few of the crates as “unwalkable” and then including “unwalkable” as “Unwalkable Tags” on the NavMesh, but without any visible effect.

    Any suggestions on how to steer clear of the crates?

    Thanks again for your help — I really appreciate it.



    After getting the teddy navigating the maze correctly, I tried to build a similar (albeit simpler) example from scratch. Worked fine except that when the character gets to its target, it doesn’t go into an idle state. I’m using the same Locomotion Animator Controller as came with the teddy example. I looked at the Animator pane and it appears that the character is trapped in the WalkRun blendtree and this appears to happen because the Speed variable never drops below 1.0 so the system correctly stays in WalkRun without ever transitioning to Idle.

    At the same time, the character doesn’t leave the target area, but kind of walks in place in a very jittery fashion: the Speed value stays at 1.0, but the AngularSpeed appears to flip back-and-forth between -90 and 90 and the Direction changes so quickly that I’m not exactly sure what it’s doing.

    Do you have any idea why the variables aren’t going to 0?




    Not sure why that would happen, except that it sounds like the AI can’t actually reach its target. Are you specifying just a move location, or both a move and face target? What is your close enough distance set to? Is the object set as the AI Body located on the ground, or is it in the middle of the object (should be on the ground).



    Initially I was specifying only a move target, but I’ve had better results now with a face target. I’ve made sure that it’s on the ground.

    I’ve played around with the “close enough” distance and angle and I’ve found that the best I can get at this point are good results some of the time. Maybe 1/2 the time, the character moves to the spot and stops (goes into idle). The only half of the time, the behavior varies: walking in place, turning in circles, walking forwards and backwards.

    I’ve gotten the best results with the following:
    close enough distance of 0.1 on both MecanimMotor and Behavior Tree
    close enough angle of 20 on both MM and BT
    Using a face target in the same location as the move target with a close enough distance of 0.5.

    Thanks for your help.

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

You must be logged in to reply to this topic.