• 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
Question by Sumaleth · Aug 18, 2015 at 08:30 PM · physicsrigidbodycarwheelcollider

Are y-axis wheelcolliders possible?

The scenario:

I have a car using a standard setup I think. Four wheelCollider wheels and a rigidBody at the top of the hierarchy.

The goal:

I want to add a fifth wheelCollider, but I want this one to be spinning around the y-axis. Like a spinning top, not like a spinning coin.

The why:

My car is getting stuck head-on facing walls and fences and corners. I want to add a smart wheelCollider to the front of my car, center-wheel height, that can effectively drive me out of those situations.

The problem:

I can add a wheelCollider to a new, separate gameobject with its own rigidBody and rotate that gameobject's transform to align the wheelCollider as I need it.

But I can't figure out how to add that system into my existing car.

If I drag it in as-is, it won't move with the car because it has its own rigidBody.

If I remove the rigidBody the wheelCollider snaps back to the car's own wheel alignment, ignoring the gameobject's transform.

If I keep it as a separate gameobject and connect them with a fixedJoint, well it was hard to see what it was doing but on some larger scale tests it was clear that collisions with the fifth "wheel" were doing crazy stuff with the attachment and were not treating the car as though it is "hard" connected. And the physics always end up exploding.

The question:

Is there a clever way to do this? Or is there a better way to get vehicles -- that have NO reverse and a 40 degree turn radius -- out of "stuck" situations?

Thanks.

Comment

People who like this

0 Show 0
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

  • Sort: 
avatar image

Answer by cjdev · Aug 18, 2015 at 08:33 PM

Instead of trying to use another wheelCollider here why not send a raycast in front of the vehicle and have it turn when it comes too close to an obstacle? Alternatively, if you're looking for the vehicle to hit the wall then move away, wait for the raycast to detect a closer distance and move the transform of the vehicle via scripting.

Comment
Sumaleth

People who like this

1 Show 1 · 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 Sumaleth · Aug 19, 2015 at 03:45 PM 0
Share

The first idea could just turn the car into another wall.

The second idea is interesting though. I hadn't thought of physically moving the car's transform. Something to try if the horizontal wheel isn't possible.

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Wheel Collider - Mesh/Box Collider Problem 0 Answers

Car - WheelCollider - Why the side is getting up? 2 Answers

Perfect friction with WheelColliders 1 Answer

How to detect my car is drifting or not ? 1 Answer

Wheel Collider Tilt? 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