Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 /
This question was closed Jul 28, 2015 at 05:37 AM by HarshadK for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by bawenang · Jul 28, 2015 at 05:12 AM · unity 5physicswheelcollider

Null attachedRigidbody of a WheelCollider

Hi guys,

I've got a weird (and posibly a bug) situation here. Currently, I am making a car prefab with a box and 4 cylinders as the wheels. This is the hierarchy:

  • Car Root (components: CarController, Player, BoxCollider, Rigidbody)
    • Body (component: BoxMesh)

    • Front Axle
      • FR Wheel (component: WheelCollider)
        • FR Wheel Model (component: Cylinder)

      • FL Wheel (component: WheelCollider)
        • FL Wheel Model (component: Cylinder)

    • Rear Axle
      • RR Wheel (component: WheelCollider)
        • RR Wheel Model (component: Cylinder)

      • RL Wheel (component: WheelCollider)
        • RL Wheel Model (component: Cylinder)

It worked fine at first. And then I tried changing the model into the proper one from an fbx file. The hierarchy is still the same. But when one line in my CarController script wanted to access the rigidbody that is attached to the wheel (WheelCollider.attachedRigidbody), it throws a null error. When I commented this line, the error is gone but all 4 wheel models (and also the wheel) goes to the world position {0, 0, 0}. I didn't do anything else besides changing the model so this is odd. And also, isn't the attachedRigidbody set automatically from the WheelCollider's parent in the hierarchy? Can anybody help me solve this?

Thanks

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 bawenang · Jul 28, 2015 at 05:35 AM 0
Share

Never$$anonymous$$d. The WheelColliders were actually not enabled. That's the cause of the bug. Thanks anyway.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

21 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

Related Questions

Help with 3D Boxcast 1 Answer

Move and rotate rigid body using 6DOF marker location from file 0 Answers

How do I make my character controller jump when I use this code? 0 Answers

Is there any way to tell a wheel collider which way gravity is without Physics.Gravity? 2 Answers

RigidBody.velocity or transform.position 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