GithubHelp home page GithubHelp logo

sergeymakeev / arcadecarphysics Goto Github PK

View Code? Open in Web Editor NEW
367.0 19.0 76.0 77.13 MB

Arcade Car Physics - Vehicle Simulation for Unity3D

License: MIT License

C# 86.15% ShaderLab 13.85%
game-development race physics unity3d racing-games source-code tutorial

arcadecarphysics's Introduction

About

My attempts to make a fun vehicle physics and arcade control. The primary goal was to make a vehicle controller which is easy to set up and fun to play with. I'm pretty happy with the results. This approach can be used for games like GTA, Rocket League or Flatout.

alt tag

Warning: This is not a final product! This is only my thoughts on the topic.

You can download precompiled demo from releases page: https://github.com/SergeyMakeev/ArcadeCarPhysics/releases/tag/1.0

Demo video available: https://www.youtube.com/watch?v=HCuJi2pntOw

Key things:

  • Speed Curve (instead of complicated engine settings)

  • Stable Suspension

  • Stablizier Bar Forces

  • Ackermann Steering

  • Downforce

  • Normalized Tire laterial friction

  • Handbrakes

  • In-flight vehicle stabilization

This demo is made using Unity game engine. It should be easy to implement this algorithm on any other game/physics engine.

Useful reading (in random order):

SuperTuxKart https://github.com/supertuxkart/stk-code https://supertuxkart.net

Bullet Physics Vehicle https://github.com/bulletphysics/bullet3/tree/79d24db60f2c916ffcdaf8b074be622e2e5bc609/src/BulletDynamics/Vehicle

Space Dust Racing UE4 Arcade Vehicle Physics Tour http://blog.spaceduststudios.com/space-dust-racing-unreal-engine-4-arcade-vehicle-physics-tour/ https://www.youtube.com/watch?v=LG1CtlFRmpU

Car Physics for Games http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html

Edy's Vehicle Physics: Anti-roll bars exposed http://www.edy.es/dev/2016/04/anti-roll-bars-exposed/

Edy's Vehicle Physics: Engine, clutch and gearbox in Vehicle Physics Pro http://www.edy.es/dev/2015/02/engine-clutch-and-gearbox-in-vehicle-physics-pro/

Edy's Vehicle Physics: Miscelaneous topics explained https://vehiclephysics.com/advanced/misc-topics-explained/

Edy's Vehicle Physics: Facts and myths on the Pacejka curves http://www.edy.es/dev/2011/12/facts-and-myths-on-the-pacejka-curves/

Edy's Vehicle Physics: The stabilizer bars: creating physically realistic, stable vehicles http://www.edy.es/dev/2011/10/the-stabilizer-bars-creating-physically-realistic-stable-vehicles/

Edy's Vehicle Physics: Pacejka 94 parameters explained - a comprehensive guide http://www.edy.es/dev/docs/pacejka-94-parameters-explained-a-comprehensive-guide/

PsRealVehicle is the plugin for Unreal Engine 4 with simple force-driven vehicle simulation. https://github.com/PushkinStudio/PsRealVehicle

The Physics of Racing http://phors.locost7.info/contents.htm

Randomation Vehicle Physics https://github.com/JustInvoke/Randomation-Vehicle-Physics

SimpleRaycastVehicle-Unity https://github.com/unity-car-tutorials/SimpleRaycastVehicle-Unity/

Car Controller blog post by Seena Burns http://seenaburns.com/2018/03/02/car-controller/

Supercharged! Vehicle Physics in 'Skylanders' https://www.gdcvault.com/play/1022942/Supercharged-Vehicle-Physics-in-Skylanders https://www.youtube.com/watch?v=Db1AgGavL8E

The Science of Off-Roading: 'Uncharted 4's' 4x4 https://www.gdcvault.com/play/1024620/The-Science-of-Off-Roading

Vehicle Feel Masterclass: Balancing Arcade Accessibility with Simulation Depth https://gdcvault.com/play/1025383/Vehicle-Feel-Masterclass-Balancing-Arcade

The Physics of Fun: The Vehicles of Saints Row https://www.youtube.com/watch?v=3XXw-2EPlL0

Implementing Racing Games: An intro to different approaches and their game design trade-offs https://superheroesinracecars.com/2016/08/11/implementing-racing-games-an-intro-to-different-approaches-and-their-game-design-trade-offs/

OpenC1 https://github.com/jeff-1amstudios/OpenC1/tree/master/OpenC1/Physics

How to write a driving simulator (Russian) https://gamedev.ru/code/articles/Racing_Simulator

NVidia PhysX: Vehicles User's Guide https://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/Manual/Vehicles.html

A 2D Car Physics Model based on Ackermann Steering http://entertain.univie.ac.at/~hlavacs/publications/car_model06.pdf

Steering theory and geometry for automobile and mechanical engineers https://www.slideshare.net/upenderrawat1/steeringtheroy

It IS Rocket Science! The Physics of 'Rocket League' Detailed https://www.gdcvault.com/play/1025341/It-IS-Rocket-Science-The

Assets

HDR Envirnoment map from HDRI HAVEN https://hdrihaven.com

Terrain textures from Texture.com https://www.textures.com

Traffic cone from "Barrier & Traffic Cone Pack" by Sabri Ayes https://assetstore.unity.com/packages/3d/environments/barrier-traffic-cone-pack-82549

Vehicle from "Muscle car 1969 Vehicle Physics (dirty and clean)" by Konstantin Koval https://assetstore.unity.com/packages/3d/vehicles/land/muscle-car-1969-vehicle-physics-dirty-and-clean-118132

Barrel from "Crate and Barrels" by Kobra Game Studios https://assetstore.unity.com/packages/3d/props/industrial/crate-and-barrels-73101

arcadecarphysics's People

Contributors

llapresi avatar sergeymakeev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arcadecarphysics's Issues

Parking Brake

I'm wondering, with raycast wheel physics what is the best way to implement parking break to prevent the vehicle sliding?

Missing textures

Hello and thank you very much for this project! I will use it to do AI for racing with Unity ML Agents.

I have a little problem, I opened the project with Unity 2018 and it seems some textures are missing, console shows no errors - https://puu.sh/DOcxD/7be31a90ea.png

Is there a fix?

Doesn't run!

This demo isn't running on my PC. It says that the app cannot be opened on this PC, so on what platforms can I actually run this game on?

Suggestion

Add Anti Braking System, it will stop and release the wheel rotation. gradually, real cars have this feature.

Terrain's material was not show

Terrain's material was not show in my project. And the Log message in Console show like follow:

Could not create a custom UI for the shader 'ArcadeCarPhysics/Terrain'. The shader has the following: 'CustomEditor = '. Does the custom editor specified include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?

Idle vehicles 'drift' backwards.

Even with the Sandbox scene, I found an idle vehicle on flat terrain will always roll backwards. I traced it to line 1114:

1114 Vector3 wsDownDirection = transform.TransformDirection(Vector3.down);

Changing wsDownDirection from local down direction to global seems to solve the issue:

1114 Vector3 wsDownDirection = Vector3.down;

I found even when the axle offset y is the same for both rear and front wheels, sometimes the car doesn't align perfectly on the ground, so wsDownDirection doesn't perfectly align with global down, so the car is 'pushed' slightly backward. Any consequences to using Vector3.down?

Brute force reverse curve evaluation is not accurate with longer curves.

Acceleration curves with a longer length that the default 10 second curve tend to be inaccurate, with acceleration faster than described in the curve.

Increasing the number of iterations of the brute force reverse curve evaluation does solve this problem but I have created a fork and associated pull-request replacing it with a binary search. This changes time complexity to O(log n) rather than O(n), honing in on the correct value in less iterations while allowing for performance tuning by the user.

Drift physics ?

Hi Sergey,

Is possible to make drift physics with your car physics ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.