RAIN{AI} and Mecanim

RAIN{AI} and Mecanim

 

糾纏了一段時間終於理解了基本部份的 RAIN{AI} 用法.

果然稱得上為偉大..

RainTest

 

也沒有使用們何程式碼就完成了 Auto follow AI, 雖然有點笨, 但沒有 coding 的情況弄到這份上實在不能再強求.

just make it simple, the step you needed to setup your auto follow bot only need a few step.

  1. Create character name it “player” have movement controller (whatever you want)
  2. Select gameObject “player” using RAIN/Create Entitly, to add Entitly inside that “player”
    1. Fill in the config of “player” Entitly, in this case I just named it “player”
    2. I set it as a vistual entitly, allow the AI to spot this gameObject on radar.

Now you finish the player part, now we need NPC.

  1. Create another character name it “bot” only need a Animator & your custom style Mecanim controller
    1. for walking, you will need at least 2 parameter “speed” & “turn angle” on your Mecanim controller, name it whatever you want,
      but remember to set exactly the same name in RAIN’s motor later.
    2. Reminder : Turn angle only allow to set within 360 degree in RAIN{AI} Version: 2.1.7.2 (Dec 19, 2014)
  2. Select gameObject “bot” using RAIN/Create AI, to add AI component inside that “bot”
  3. First thing first, switch to sensor tab, give this object have visual sensor,
    it use this as eyes to see the player later.
  4. Switch to motor tab, add parameter the variable name of “speed” & “turn angle” in Mecanim controller.
  5. now “bot” can walk and see thing, but it still no BRAIN.
    Switch to mind tab, create a behaviors tree for it,
  6. Inside a behaviors tree, create a set of action for this “bot”
    1. Create “sensor” I name it as “Search player” and put the world coordinate into the variable name “FollowTarget”
    2. Create “move” action, I name it as “Move to player”, it read the coordinate from “bot” ‘s mind. “FollowTarget”
      then it will use “speed” & “turn angle” different to find the path to go to the “player”, automatically

here is the result.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

*

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料