Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 BodaciousP · Nov 18, 2018 at 02:43 AM · physicsracing gameridgidbody

(C#) How would I go about making physics like F-Zero GX's?

I'm in the process of creating a 3D futuristic racing game similar to F-Zero GX. I have tracks that are full of twists, turns, loops, slopes, and other things that require the car's gravity to follow the track, but I can't seem to figure out how to accomplish this. I've been searching for an answer all day to how I could accomplish this, but all solutions I have attempted have not worked. Any help would be appreciated, and just tell me if I need to provide more information.

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

· Add your reply
  • Sort: 
avatar image
0

Answer by Matt1000 · Nov 18, 2018 at 04:16 AM

I actually already did a mechanism like this one. Pretty much how Mario galaxy works. I'll break it down for you.

Basically, your objects gravity should be the terrain's normal. A plane's normal is a perpendicular vector to that plane. In other words is an "up" line from any surface. To calculate it you need to calculate the cross product of two vectors that are from the plane. The cross product is not a problem since you can simply do Vector2.Cross() and that it. You'll need two vectors parallel to the surface NOT parallel between them though.

It's really not that hard once you wrap your head around it.

To calculate a vector parallel to a surface you can simply use two points from that surface. You just do P2 - P1. and you'll get a vector from P1 towards P2. If you have another point you can do P3 - P1 and you'll have your two vectors. It's very important not to use three points in a row otherwise both vectors will be the same... Generally, P1 can be the point the player/object is on and if P2 is in front then P3 would be to the side (in front and the back won't work.)

IMPORTANT: If you are over curve objects you CANNOT use the point below you, since it will lead to the normal being a little off. If that's the case One vector needs to be P1 - P2 (P1 being in front of you and P2 to your back) and the other P3 - P4 (P3 to your right and P4 to your left). That will be enough to even the surface.

Once you have normal you just need to do a little trick. This normal can actually be 2 different vectors, might be the vector you need or the opposite one, in which case your object will start floating away. Just do a check from your object towards the vector that you got and if you hit something, then it's the right one. If you get the "up" vector, check if there is something. Since there won't be anything, use the other one.

NOTE: all these points need to be really near to you. Otherwise, it may not work very well. And many times this mechanism has problems with lowpoly objects.

After all that you can create extra things like stabilizers but that is the basis. Might seem hard but it a lot of simple things really.

Hope it helps ; )

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 BodaciousP · Nov 18, 2018 at 08:20 PM 0
Share

I think I got the normal, now how would i set the gravity to it?

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

162 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 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 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 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 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 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 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 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

SoftBodys with Cloth :: Locking to transform 0 Answers

I want my Player to have collision physics 1 Answer

rigidbodies with flight physics and autopilot - Approach? 0 Answers

Player does not Jump Issue(Unity3D) 1 Answer

2D 360 degress platformer example needed 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