Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Thor20 · Nov 06, 2015 at 03:34 PM · javascriptmovements

Turning an object by code over time in custom function

I have AI I want to turn a bit before taking a step in the new direction. I don't want to use update function, is this possible? The AI needs to turn over time.

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 Thor20 · Nov 06, 2015 at 03:51 PM 0
Share

I am trying a "for" statement in there but still jumps a bit and not smoothly turning like on ice.

avatar image Rotsuoy · Nov 06, 2015 at 07:42 PM 0
Share

I probably won't be of much help here, but I thought I would at least try and see if I can... If I'm reading you correctly, this is a problem I would, personally, solve with animations, but I'm not sure you're going to get something smooth like turning on ice without rotating the 'thing' with the update function. Is there a particular reason why you don't want to use it?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by HenryStrattonFW · Nov 06, 2015 at 05:02 PM

you will need to use some sort of repeating function. If you're set on not using update then you have two main options, Coroutines, or InvokeRepeating.

Coroutines will run each frame until they finish what they have to do but can have various delays depending on how they are yielded. InvokeRepeating will run a method a set number of times, with a set interval between each execution.

Hope this helps point you in the right direction.

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

Answer by Dibbie · Nov 06, 2015 at 08:15 PM

Using the Update function, would probably be the easiest way... Though you could also use an InvokeRepeating, or a while loop in another function outside of Update, that gets called only once (so you dont have a repeating while loop), and change its rotation a slight bit every time.

Though if you do decide to use Update, you can use a clamp or a slerp, or even a simple Rotate on the object.

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

36 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 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

Game got slow down On iphone 0 Answers

Can anyone make a timer for me? 0 Answers

How can i make an animation like csgo case opening? 2 Answers

How to make a player move up then forward using ontrigger enter collider? 0 Answers

Smooth aiming script don't work 0 Answers


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