• 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 /
This question was closed Jun 29, 2011 at 01:11 AM by testure for the following reason:

Question was answered in comments

avatar image
0
Question by Yarz · Jun 22, 2011 at 11:39 PM · rotationdirection

Character rotation is resetting

Hello all,

I'm working on a bicycle race game where you can ride free, and at certain points you can start a race. When a user wants to start a race i want to position the bike to the start point of a race.

I do this with the following lines of code:

 var startposition : Vector3;
 var startdirection : Vector3;
 
 startposition = Vector3(10,10,10);
 startdirection = Vector3(0,90,0);

 // when start button pushed:
 gameObject.Find("Bike").transform.position = startposition;
 gameObject.Find("Bike").transform.eulerAngles = startdirection;    

For the position this is working fine. The rotation is a little of a problem: For like 3 or 4 frames it sets the direction correct, however after that few frames it changes it´s direction to the previous direction.

Any ideas how to fix this? Thanks in advance.

Comment
Add comment · Show 9
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 Dreamblur · Jun 23, 2011 at 12:10 AM 0
Share
   startdirection = Vector3

is not a valid statement.

avatar image Yarz · Jun 23, 2011 at 01:00 AM 0
Share

changed it, but this was a typo.

avatar image aldonaletto · Jun 23, 2011 at 01:20 AM 1
Share

I suspect the problem is in another part of your script. $$anonymous$$aybe you're storing the current direction in some var, and somewhere in your script it's restoring the original rotation. Do your bike have a rigidbody?

avatar image Chris D · Jun 23, 2011 at 01:25 AM 0
Share

what does your update() function look like, for example?

avatar image AlanChatham · Jun 23, 2011 at 05:32 AM 0
Share

Out of curiosity, does that snippet take place inside a GetButton("Start") event? If you hold the button, does the bike stay in the proper rotation?

Show more comments

0 Replies

  • Sort: 

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

7 People are following this question.

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

Related Questions

Shoot an object and have it move based on rotation 1 Answer

How do I find this direction vector? 2 Answers

Tree Fall Direction 1 Answer

Straighten out camera rotation 1 Answer

How to make a movement system that changes with your viewpoint but also lets you hit multiple keys at once to go diagonally? 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