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
1
Question by LS16BMX · Dec 14, 2011 at 12:24 PM · raycastraycastingwheelwheel-collidermotorbike

How to make a custom wheel collider ?

This is something i'm trying to get to grips with although at the moment I have no real reference on how to go about it. I pretty much need the standard unity wheel collider however instead of the usual raycast replaced by a sphere cast in its place. This will enable full surface collision with the wheel instead of the normal issues facing standard wheel colliders not working for wheelies or colliding properly with the environment. Question is do I have to re write an entire new wheel collider system or is it possible to modify the existing system making use of the Physics.SphereCast function ?

Comment
Add comment · Show 15
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 ikelaiah · May 28, 2013 at 03:34 AM 0
Share

Will someone help this person?

avatar image Benproductions1 · May 28, 2013 at 04:39 AM 0
Share

You can't do it with a spherecast, it doesn't have enough information. What you could to is multiple raycasts, which should work :)

avatar image ikelaiah · Jun 10, 2013 at 04:14 AM 0
Share

@Benproductions1 Could you give more information?

avatar image Benproductions1 · Jun 10, 2013 at 07:42 AM 0
Share

Nope I was wrong, spherecasts to give enough information. I suggest you study rigidbody dynamics and with that, learn how to implement your own wheel collider :)

avatar image LS16BMX · Jun 10, 2013 at 08:56 AM 0
Share

I know people who have got sphere casts to work but as of yet not figured out how to get them working myself, i'm not a hardcare coder so could really use some help with this if anybody can please pitch in :)

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Scribe · Jun 10, 2013 at 12:24 PM

I hadn't noticed how old the question was until after I commented, it appears someone else wanted it reawakened!

Anyway, attaching a script like the one below to your wheel object will create a collider for it though it won't have all the variables that a wheel collider exposes so you may have to code those yourself.

 private var col : MeshCollider;
 
 function Start () {
     col = gameObject.AddComponent(MeshCollider);
     col.isTrigger = false;
     col.sharedMesh = gameObject.GetComponent(MeshFilter).mesh;
     col.convex = true;
 }

Personally I think your implementation of the sphere collider looks pretty good but maybe you will have problems if you want the bike to fall over.

Not sure if this will help, good luck!

Scribe

Comment
Add comment · 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 MadMenyo · Oct 09, 2016 at 10:57 AM 0
Share

It's a Q/A site. It doesn't matter if a question is old. A ton of people come here to the unity Q/A and find questions without answers. I know your Answer is 3 years old but since your still active I thought I comment.

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

7 People are following this question.

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

Related Questions

Raycast exit point of collider 0 Answers

Raycasting doesn't hit terrains 0 Answers

Upper limits of Raycasting; Physics engine "gives up" 0 Answers

What's wrong with my RayCastHit2D? 0 Answers

Raycast origin overlapping surface of collider counts as a hit 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