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 alsanoja · Mar 05, 2015 at 10:43 AM · animationai

AI 2d sprite animation in 3d isometric realm based on direction

Currently I am trying to have an AI change an animation based on the direction it is going. Essentially it has 4 movement animations, one in each direction. It constantly is chasing the player (a specific point that gets updated), but I am not exactly sure how to make it change animation without an input. I've been trying to compare positions or vector3 velocity, but I don't really know the best way to go about it and actually make it work. Any insight on best practice or a good method to do it would be fantastic!

Comment
Add comment · Show 4
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 meat5000 ♦ · Mar 05, 2015 at 02:01 AM 0
Share

Use parameters! Link them in a script. You can control an animation using any variable this way.

You can change your walk speed based on how much red there is in a colour!

avatar image alsanoja · Mar 06, 2015 at 10:03 PM 0
Share

Well then the question is what types of parameters to compare to one another. I already tried two different positions and two different vector3's.

avatar image siaran · Mar 07, 2015 at 12:15 AM 0
Share

So if I'm reading this right, you have an enemy gameobject, and you have it moving, but somehow you don't know the direction it's moving in?

If you cannot access your move direction vector for some reason, you could subtract your previous object position from your current one to get it. Then, assu$$anonymous$$g you have 4 move directions (up, down, left, right or something), you could say something like (pseudocode) if moveDir.x > 0 do up animation else if movedir.x < 0 do down animation else if movedir.y > 0 do left animation else if movedir.y < 0 do right animation else do idle animation

That's probably not really the best way to do it, but it's as far as I can get without knowing more about your implementation.

avatar image alsanoja · Mar 07, 2015 at 10:52 PM 0
Share

I think that idea might actually work well! I am relatively new to vector math, but looking at it again that seems like a good way. I was going to subtract the enemy object position from the character's (the target)

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

zombie ai script(animation help) 0 Answers

All AI animations stop on first frame 0 Answers

Can I make animations snap to a frame? 1 Answer

Detecting the right time to play a landing animation? 2 Answers

Couple of questions regarding AI scripts and animation? 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