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 sam32x · Nov 18, 2011 at 06:57 AM · rotatesomething

object rotating around parent

i have this to make my tyres move

 tyre1.transform.Rotate(Vector3.forward * Time.deltaTime * movespeed * 5);
 tyre2.transform.Rotate(Vector3.forward * Time.deltaTime * movespeed * 5);
 tyre3.transform.Rotate(Vector3.forward * Time.deltaTime * movespeed * 5);
 tyre4.transform.Rotate(Vector3.forward * Time.deltaTime * movespeed * 5);


not the whole script^^

the tyres rotate around the parent race car instead of rotating normally how do i make them rotate normally?

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 syclamoth · Nov 18, 2011 at 07:02 AM

You need to make sure that the tyres' pivot points are in the right locations! From the sounds of things, each tyre's pivot point is the centre of the car, not the centre of the wheel. Make sure you have your handles set to 'pivot' not 'centre'- and if you can't change the models to be right, try adding intermediate empty game objects which have the correct pivot point, between the car and the wheels on the transform hierarchy.

Comment
Add comment · Show 6 · 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 sam32x · Nov 18, 2011 at 07:09 AM 0
Share

nope the origin is in the right place

avatar image sam32x · Nov 18, 2011 at 07:12 AM 0
Share

wait actually they are rotating around the center of the 4 tyres

avatar image syclamoth · Nov 18, 2011 at 07:13 AM 0
Share

Well, then I can't explain it. It should definitely be working the way you want it, unless there's something you haven't told me.

avatar image sam32x · Nov 18, 2011 at 07:22 AM 0
Share

heres the whole script

 var movespeed = 0;
 var turn = 0;
 var maxspeed = 16;
 var $$anonymous$$speed = -8;
 var breakspeed = 0.2;
 var tyre1 : GameObject;
 var tyre2 : GameObject;
 var tyre3 : GameObject;
 var tyre4 : GameObject;
 
 
 function Update () {
 transform.Translate(Vector3.left * Time.deltaTime * movespeed);
 transform.Rotate(Vector3.up * Time.deltaTime * turn);
 
 tyre1.transform.Rotate(Vector3.forward * Time.deltaTime * movespeed * 5);
 tyre2.transform.Rotate(Vector3.forward * Time.deltaTime * movespeed * 5);
 tyre3.transform.Rotate(Vector3.forward * Time.deltaTime * movespeed * 5);
 tyre4.transform.Rotate(Vector3.forward * Time.deltaTime * movespeed * 5);
 
 if (Input.Get$$anonymous$$ey("space")){
 movespeed -= breakspeed;
 }
 
 if (Input.Get$$anonymous$$ey("a")){
 turn -= 10;
  }
  
 if(Input.Get$$anonymous$$ey("d")){
 turn += 10;
 }
   
   if (Input.Get$$anonymous$$ey("w")){
 movespeed += 1;
   }
   
    if (Input.Get$$anonymous$$ey("s")){
   movespeed -= 1;
 }
 if (movespeed >= maxspeed){
 movespeed = maxspeed;
 }
 
 if (movespeed <= $$anonymous$$speed){
 movespeed = $$anonymous$$speed;
 }
 
 if (turn >= 0){
 turn -= 5;
 }
 
 if (turn <= 0){
 turn += 5;
 }
 
 if (turn >= 135){
 turn = 135;
 }
 
 if (turn <= -135){
 turn = -135;
 }
 
 if (movespeed <= 0){
 breakspeed = -0.02;
 }
 
 if(movespeed >= 0){
 breakspeed = 0.02;
 }
 }
avatar image sam32x · Nov 18, 2011 at 07:36 AM 0
Share

oh wait i can just do an animation and change the speed

Show more comments

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

how to make an object "the target" when you click on it 3 Answers

object rotates when moving backward 1 Answer

script for object to rotate around and come back 1 Answer

function error 1 Answer

manabar doesnt work 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