• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JoshMBeyer · Dec 16, 2012 at 06:07 PM · airunning

How to create a Animal like AI? For Hunting game.

Hi, I am making a single player hunting game. Everything has been going pretty smooth so far, although now I am kind of stuck. I can make a AI to follow me and move towards me.. But I can't figure out how to make it run away..

What I want my "DeerPrefab" to do is wander around (doesn't have to be highly detailed or anything) just simple for now) and when my player comes with in a certain distance (I prefer a random range) The deer will "Notice Me" and run away. (Increasing speed from walking to running speed.)

If I could figure out how to write AI I would want to write a script to where the deer walks around stopping every now and again to rest (Laying animation would play) then sometimes stopping in the middle of a field and a eating grass animation would play. If my player was close but crouched then I can get closer than I would be able to if standing.. Just kinda realistic but I have no clue on how to go about doing that or learning how. So if knows of or can think of a simple script to make the deer walk, then run away if i come too close, please help me out.

Thanks.

PS: I Code in C# if you can write in C# format that would help.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lockstep · Dec 17, 2012 at 03:52 PM 0
Share

An AI script is bound to be not a simple script. And i highly doubt anybody here would write you a complete script. This is something you would have to figure out largely by yourself since this is less about coding but rather about logic.

What you could try to do is do calculate the distance between your deer and the player. If the player comes near you toggle a boolean variable. Inside of your behaviour routine you would check with an if statement for your bool and have your deer behave accordingly.

avatar image JoshMBeyer · Dec 21, 2012 at 02:24 PM 0
Share

Found exactly what I was looking for.

http://www.swinburne.edu.au/design/tutorials/P-unity/T-How-to-implement-a-Waypoint-script-in-Unity/ID-260/

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Aron954 · Apr 02, 2013 at 04:41 PM

Hi

I may support you with some good ideas with the whole hunting game concept not actually coding. This is the link to the main video game concept, I will give more in-depth game-play concept if you like: Hunting Simulator


hunting simulator.pdf (147.6 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

My NavMeshAgent doesn't move at all!,Why my NavMeshAgent doesn't move at all? 0 Answers

Enemy tank AI script TopDown 0 Answers

Character constantly running up a slope 0 Answers

Sprinting Script Issue 1 Answer

Adding momentum to jumping from previous movement 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges