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 bachan · Aug 30, 2010 at 10:00 AM · position

change position and play animation

I have this frog AI that should go to a certain location using waypoint and while changing its position my object should play its animation jump.

here's my code but its not working

function Update () { var frog = GameObject.Find("try"); if (frog.transform.position(0>1,0>1,0>1)) animation.CrossFade("jump");

else animation.CrossFade("idle"); }

yes its changing its position but its not playing its animation? please help

Comment
Add comment · Show 1
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 · Aug 30, 2010 at 10:24 AM 0
Share

Use the 'code' tag (icon with 0s and 1s) to format code.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by · Aug 30, 2010 at 10:26 AM

Your ifcheck is always true. What are you trying to check?

Also, you should put the 'frog' declaration in Awake(), so it's not looked up every frame.

function Awake () { var frog = GameObject.Find("try"); // Set it once here, so it doesn't search every frame }

function Update () { if (frog.transform.position(0+1,0+1,0+1)) // This will always be true - you are just setting the position animation.CrossFade("jump"); else animation.CrossFade("idle"); }

Comment
Add comment · Show 2 · 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
avatar image bachan · Aug 30, 2010 at 10:30 AM 0
Share

so should it be if(frog.transform.position(0>1,0>1,0>1)) animation.CrossFade("jump"); ??

avatar image · Aug 30, 2010 at 10:56 AM 0
Share

No - I don't understand what you're trying to get it to do. At the moment you're changing its position and at the function just returns true. Perhaps edit your question and list out what you are actually trying to achieve. When you say 'waypoint', what do you mean?

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

No one has followed this question yet.

Related Questions

Camera rotation around player while following. 6 Answers

Get Mouse Position GUI 3 Answers

My AI keeps flickering between stopping and moving. 1 Answer

Is it possible to assign a quaternion value to the position vector of a object? 1 Answer

Weapon Possition Move On Sprint 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