Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 jveronda · Mar 01, 2014 at 12:11 AM · animationenemynpcenemyaikey-frame animation

Scripting an animation for an NPC?

I've got my enemy AI script set up and it works great. When I get closer to my enemy, the enemy gets angry, chases and attacks me. The next step is to get the walking/running animation for my NPC. I understand how you would animate the player walking,have something like Input.GetButtonDown()and then have it triggered to whatever key you are using to walk forward. I'm a bit confused on how to have it on the NPC. maybe something like if the position changes? Thank you!

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by C10110 · Jul 20, 2014 at 07:32 PM

Ha, I found this on a search looking for the same answer. It seams a lot of people want a tutorial like this. I too have AI scripts that get things like capsules moving around just as I need and understand fine and well how to set up transitions for animations and script player controls, but am at a loss on how to set up npc scripts for animations.

People keep telling me "it's no different" and that all I have to do is substitute the code where the GetButtonDown code is used for my own event for the npc. But it just doesn't make sense to me. I have only been coding three months so an actual tutorial would be most helpful.

The example someone told me was like if the npc is seen by the player then make them do a certain animation. But that makes no sense to me as I don't want them only doing that animation when they are seen and...blah...

I feel like the way you're supposed to go about it is however your ai scripts are handled you go off that maybe? But again, I don't know how that code would be executed. So like, in my ai scripts I have guys that wander and find waypoints if they can. So do I need to tell my animation controller script to play certain animation when they are wandering? And then when they find a waypoint? I just don't get it man I'm right there with you, it is frustrating that nobody seams to think a tutorial on npc setup through Mecanim would be useful. As it so would be. There isn't even anything for this to buy in the asset store.

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.

Follow this Question

Answers Answers and Comments

21 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Animation not following character? 0 Answers

How to freeze enemy movement when Hurt/enemy Damage? 1 Answer

How to add new animations to enemy NPCs through mecanim? 0 Answers

Adding gravity to NPC, such as an enemy or animal? 0 Answers

Enemy Patrol - Random Walk 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