[Mod] Car that drifts and skids [driftcar]

Post Reply
User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

[Mod] Car that drifts and skids [driftcar]

by paramat » Post

***** This repository has been deleted. Development of the 'driftcar' mod continues in my 'driftgame' game viewtopic.php?f=50&t=25367 *****

Image

^ Smoke particles come from each wheel when skidding.

Description
-----------
A vehicle using some physics modelling for more realistic behaviour.

Usage
-----
Due to client->server->client control delay this mod is best used in
singleplayer or in local multiplayer.
Intensive mods that cause long server lags, such as Lua mapgen mods, will affect
the responsiveness of the vehicle, even in singleplayer.

There is no crafting recipe, the vehicle can be found in the creative inventory.
Third-person camera mode is recommended when driving for a better view.
If parameter 'AVIEW' in the 'init.lua' file is set to 'true', view is
automatically set to vehicle velocity direction.

Controls
--------
Right mouse button = Enter or exit car when pointing at car.

Forward = Speed up. Slow down when moving backwards.

Backward = Slow down. Speed up when moving backwards.

Left = Rotate anticlockwise.

Right = Rotate clockwise.

More stuff
----------
Something i have wanted to do for a long time, use my knowledge of physics to create a car that has fairly realistic skidding behaviour. It's capable of drifting, doughnuts and J-turns.
Due to the issues mentioned above it's best tried out first in singleplayer, flat mapgen, with no other mods running, for best responsiveness.

4 forces (accelerations) are modelled:
Linear force due to wheel torque: accelerating or braking. Acceleration torque falls to zero at a certain speed.
Linear force due to rolling resistance. Constant and opposite to linear motion.
Air drag opposite to velocity. Opposite to velocity and proportional to speed.
Lateral force due to tire grip. Opposite to lateral motion. This is limited so that when tire grip is overcome when turning skidding occurs.

Turning is acheived by rotating the vehicle, the lateral force is what actually alters the direction of motion.
Some of the 4 forces are set to zero if the vehicle is not in contact with the ground. This can be seen if turning while driving off the side of a cliff.
Attachments
screenshot_20180806_003812.png
screenshot_20180806_003812.png (343.71 KiB) Viewed 1546 times
Last edited by paramat on Tue Nov 03, 2020 15:01, edited 1 time in total.

Chiantos
Member
Posts: 377
Joined: Sun Jan 15, 2017 09:04

Re: [Mod] Car that drifts and skids [driftcar]

by Chiantos » Post

Deleted message
Last edited by Chiantos on Mon Sep 30, 2019 05:03, edited 1 time in total.

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Car that drifts and skids [driftcar]

by Byakuren » Post

Are the front and rear tires modelled separately?
Every time a mod API is left undocumented, a koala dies.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Car that drifts and skids [driftcar]

by paramat » Post

The car entity has visual type "wielditem", so the car is simply modelled as a nodebox, no need to use blender.
The nodebox has 6 boxes: upper half, lower half, plus 4 boxes for the parts of the wheels that protrude downwards (the lowest 2 pixels of the wheels).

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Car that drifts and skids [driftcar]

by Byakuren » Post

Sorry, I meant physics modeling.
Every time a mod API is left undocumented, a koala dies.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Car that drifts and skids [driftcar]

by paramat » Post

I see. No, all wheels are assumed to be fixed and non-steering. The car is rotated around it's y axis according to control inputs in a simple way.

Teen_Miner
Member
Posts: 46
Joined: Fri Jun 03, 2016 18:21
GitHub: LapisWolf
IRC: LapisWolf
In-game: LapisWolf

Re: [Mod] Car that drifts and skids [driftcar]

by Teen_Miner » Post

This game makes me wish i appreciated the mod before. Now i want an updated stand-alone mod with more cars and colors. I can easily see myself drifting on streets with this.
cdb_yuId0gpEgnYo

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Mod] Car that drifts and skids [driftcar]

by paramat » Post

Teen_Miner,
In case you missed the relevant text (you should read it) in the first post of the 'driftgame' game thread ...
The improved 'driftcar' mod contained in 'driftgame' will probably work with most games as a standalone mod.
It is up to you or others to fork driftcar (driftgame version) or driftgame and derive new things from them, that is my intention for them. Driftgame is only a demonstration game for the physics modelling code.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 34 guests