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 AusAndrew19 · May 28, 2012 at 10:02 AM · carissue

Car Wheels Error/Glitch/BUG, Please help.

Hey Guys. I am creating a racing car game. I have my car functioning 99% well. It drives/stears fantastic. I have a computer car that races with you. It works beautifully. The only issue im having atm is. When i created my car i used the actual spokes inside the rim to be the rotating axis so it looks more real. But when i start the game my rims stick out the side and it looks so goofy. Should i edit my model and make the wheel one object or should i simply move the actual wheel script to a different component. Here is pictures of the actual bug.

This is the car When the rims are being stupid. alt text

This Is The Car Behaving beautifully before i play the game. alt text

So i was wondering if you guys have any information that could help this error. Thank you :)

Wheel working..png (160.5 kB)
Wheel function.png (181.1 kB)
Comment
Add comment · Show 3
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 hirenkacha · May 28, 2012 at 10:22 AM 0
Share

have you checked your normals settings?

avatar image hirenkacha · May 28, 2012 at 10:24 AM 0
Share

by the way good design...

avatar image AusAndrew19 · May 28, 2012 at 10:36 AM 0
Share

Thanks mate, I didn't design it i bought this model in a pack. When you say did i check my normal setting what do you mean mate? I'm not too sure on what you mean since im a bit of a noob :)

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by hirenkacha · May 28, 2012 at 10:23 AM

Check your wheel colliders pivot and your wheel's pivot if you are making them reference to eachother at runtime.

Comment
Add comment · Show 4 · 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 AusAndrew19 · May 28, 2012 at 10:41 AM 0
Share

Sorry mate not too sure on what you mean pivit. This is the script for the wheels if this helps.

// Define the variables used in the script, the Corresponding collider is the wheel collider at the position of // the visible wheel, the slip prefab is the prefab instantiated when the wheels slide, the rotation value is the // value used to rotate the wheel around it's axel. var CorrespondingCollider : WheelCollider; var SlipPrefab : GameObject; private var RotationValue : float = 0.0;

function Update () {

 // define a hit point for the raycast collision
 var hit : RaycastHit;
 // Find the collider's center point, you need to do this because the center of the collider might not actually be
 // the real position if the transform's off.
 var ColliderCenterPoint : Vector3 = CorrespondingCollider.transform.TransformPoint( CorrespondingCollider.center );
 
 // now cast a ray out from the wheel collider's center the distance of the suspension, if it hit something, then use the "hit"
 // variable's data to find where the wheel hit, if it didn't, then se tthe wheel to be fully extended along the suspension.
 if ( Physics.Raycast( ColliderCenterPoint, -CorrespondingCollider.transform.up, hit, CorrespondingCollider.suspensionDistance + CorrespondingCollider.radius ) ) {
     transform.position = hit.point + (CorrespondingCollider.transform.up * CorrespondingCollider.radius);
 }else{
     transform.position = ColliderCenterPoint - (CorrespondingCollider.transform.up * CorrespondingCollider.suspensionDistance);
 }
 
 // now set the wheel rotation to the rotation of the collider combined with a new rotation value. This new value
 // is the rotation around the axle, and the rotation from steering input.
 transform.rotation = CorrespondingCollider.transform.rotation * Quaternion.Euler( RotationValue, CorrespondingCollider.steerAngle, 0 );
 // increase the rotation value by the rotation speed (in degrees per second)
 RotationValue += CorrespondingCollider.rpm * ( 360/60 ) * Time.deltaTime;
 
 // define a wheelhit object, this stores all of the data from the wheel collider and will allow us to deter$$anonymous$$e
 // the slip of the tire.
 var CorrespondingGroundHit : WheelHit;
 CorrespondingCollider.GetGroundHit( CorrespondingGroundHit );
 
 // if the slip of the tire is greater than 2.0, and the slip prefab exists, create an instance of it on the ground at
 // a zero rotation.
 if ( $$anonymous$$athf.Abs( CorrespondingGroundHit.sidewaysSlip ) > 2.0 ) {
     if ( SlipPrefab ) {
         Instantiate( SlipPrefab, CorrespondingGroundHit.point, Quaternion.identity );
     }
 }
 

}

avatar image AusAndrew19 · May 28, 2012 at 11:11 AM 0
Share

Sorry if script isnt well presented i dont know how to add it to code box.

avatar image hirenkacha · Jun 01, 2012 at 10:17 AM 0
Share

@AusAndrew : Sorry for late reply. I think your wheelcollider is too much inward. Check with pulling out your wheelcolliders slightly. And check your car model's wheel's center where it is? Wheelcollider's center and your 3d wheel model's center should be get adjusted. It wld woek fine.

avatar image AusAndrew19 · Jun 04, 2012 at 03:39 PM 0
Share

$$anonymous$$ate, Truly... Thank you! :) I Followed what you said and a little adjusting i got it!! Thank you! :)

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How to toggle a key for a car to go forward or backward? 1 Answer

Renaming objects brakes the aniamtion 0 Answers

How do you add a mesh to a LOD Level in Code? 0 Answers

Help with trigger zone 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