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
3
Question by Hoeloe · May 09, 2013 at 08:33 PM · physicsraycastracingmariomario kart

Kart Racer (Mario Kart/CTR) Physics

Hello. I'm pretty new to Unity, and I'm still trying to get my head around how the physics engine works. I'm trying to create a cartoon-styled kart racing game, based on Mario Kart and/or Crash Team Racing. I've made a few attempts at this. My first one used the built-in WheelColliders, but I had serious issues getting the kart to stay upright (even when the centre of mass was as low as it could go, it was still possible for the kart to fall over). I tried a different tactic, which was to use Raycasts to align the kart to the ground, and apply the rest of the physics through the rigidbody. This didn't work either, because the physics were horribly temperamental, and caused the kart to spin off in all directions as I tried to correct it.

My third attempt is what I have at the moment, manually coding gravity and movement so that it works nicely and smoothly, and always faces the right direction. This works very well (in fact, better than the last, as I have control over the direction of gravity, which will be helpful later in the project). There is an issue with this, though. The kart can't collide with walls, and will sometimes go through the floor, because there is no collision detection. I can fix both these problems by adding a rigidbody, and fixing it's position and rotation, but then it causes an awful jittering, which makes the game virtually unplayable.

Essentially, my question is this: How could I build a racer without the realistic physics emulation built into Unity? The features I'm trying to include are:

  • Kart always faces the ground

  • When Kart leaves the ground, it orients vertically

  • Kart can collide with walls if they are too steep

  • Kart can accelerate and decelerate

  • Kart can turn with a fixed degree of rotation

  • Kart can skid when a button is pressed

  • Kart can jump a small amount when a button is pressed

I can get most of these working, but there are always one or two that just never seem to come out right. I'm sure it's not an overly complicated engine to build, but since I'm so unfamiliar with Unity, the method for doing so always seems to escape me. I'm used to having to build everything from scratch, so this script method of programming is very jarring for me, and it makes things that should be simple just that little bit more complex.

Anyway, some help here would be most welcome. I can post what code I have if it would help.

Comment
Add comment · Show 2
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 Guendolin · May 11, 2017 at 08:40 PM 0
Share

Hi!

I I'm currently working on a similar project and I would love to take a look at your project or see how you did it more in detail.

Currently I'm using an etererly physics based aproch but it have its disatvantages so I would love to get to see some more sample codes from other arpoches.

avatar image Guendolin · May 11, 2017 at 08:45 PM 0
Share

Hi!

Did you get it to work?

I'm currently working on a similar project but I took a physics based aproch that seams to have some distatvantages and I'm looking for alternatives.

How did it turn out for you? Do you have some samplecode I can look at for insperation or a project to share?

Would love to get some help!

1 Reply

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

Answer by Hoeloe · May 23, 2013 at 03:02 PM

I got pretty much everything working. I used this code as a base, and built it from there: https://www.youtube.com/watch?v=Wpv9UMM9GCE

Comment
Add comment · 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

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

15 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

Related Questions

Mario Kart Style Car Physics II 1 Answer

Physics required for collision detection? 2 Answers

Skateboard slope problem 0 Answers

Physics.Raycast (Cheapest Methods) 0 Answers

Creating a magnetic vehicle (like F-Zero) 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