Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

i need help!!!

Discussion in 'Getting Started' started by forme123, Feb 3, 2015.

  1. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    so im making survival fps game
    i need fish AI script i have models of sharks, whales, etc... with ofcourse animations
    how to make shark to swim in water so do i need bake scene or?
    and i have advanced ai pro when i add script to shark and do options "waypoints, animation set, target and etc"
    on baked scene my shark go out of terrain and staying in place with "walk" anim.
    so if anybody can help me :)
     
  2. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,887
    I don't know anything about this Advanced AI Pro.
    But is there a possibility you still need to do a Vectro3.forward? That way the Shark knows to move forward (towards) this waypoint.

    Again, I could be totally wrong as I don't know how that AI system works.
     
  3. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    hmm, can you.. if you want to send me a link of other ai asset with waypoints and agressive :)
    and one more question if ai have way points do i need navmesh scene ?
     
  4. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,887
    Honestly, all i can say is just search the Asset Store. I don't really purchase AI stuff. I just make my own.
    I find it easier, at least for the sake of what I want to do lol.

    The easiest way to do your own way points is to put some empty game objects around the map, and tell your Shark to go to it.

    something like. (MAY OR MAY NOT WORK) - NOT TESTED.

    Code (CSharp):
    1. public GameObject[] Waypoints;
    2. public float Speed;
    3.  
    4. void Update(){
    5. foreach(GameObject wayP in Waypoints){
    6. this.transform.LookAt(Waypoints)
    7. transform.Translate Vector3.forward * Speed * Time.delaTime;
    8. }
    9.  
    10. }
     
  5. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    tnx for answering
    so i was on youtube and looking for fish ai and i found speedtutor channel one with fish ai tutorial xD
    so this is his js

    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. var target : Transform[];
    5. var isMoving : boolean = false;
    6.  
    7. var speed : float = 5.0f;
    8.  
    9. private var newTarget : Transform;
    10.  
    11. function Start()
    12. {
    13.     animation.Play("loop_swim");
    14.     animation["loop_swim"].wrapMode = WrapMode.Loop;
    15.     animation["loop_swim"].speed = 2;
    16. }  
    17.  
    18. function Update()
    19. {
    20.     if(isMoving == false)
    21.     {
    22.         newTarget = target[Random.Range(0, target.length)];
    23.         isMoving = true;
    24.     }  
    25.  
    26.     transform.position = Vector3.MoveTowards(transform.position, newTarget.position, speed * Time.deltaTime);
    27.     transform.LookAt(newTarget.position);
    28.  
    29.     if(transform.position == newTarget.position)
    30.     {
    31.         isMoving = false;
    32.     }  
    33. }
     
    Last edited by a moderator: Feb 3, 2015
  6. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    i just wondering do i need bake scene and i dont need lol
    shark move to box "waypoints" so i need find that ai can go to waypoints if ai see player attack when player escape return to waypoints or if player die return to waypoints :D
     
  7. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    so anybody want help me?
     
  8. AuroreUnity

    AuroreUnity

    Principal Product Manager Unity Technologies

    Joined:
    Aug 1, 2012
    Posts:
    3,108
  9. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    im not good in scripting im good at modeling and etc. so i need script that "shark" go to waypoints when he see player, stop waypoints, attack player, if shark kill player , return to waypoints
     
  10. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    anybody?
     
  11. AuroreUnity

    AuroreUnity

    Principal Product Manager Unity Technologies

    Joined:
    Aug 1, 2012
    Posts:
    3,108
  12. forme123

    forme123

    Joined:
    Feb 3, 2015
    Posts:
    17
    i will look tnx
     
    AuroreUnity likes this.