[Mod] Car that drifts and skids [driftcar]

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

[Mod] Car that drifts and skids [driftcar]

by paramat » Mon Aug 06, 2018 00:24

Image

^ Smoke particles come from each wheel when skidding.

Download https://github.com/paramat/driftcar/archive/master.zip
Browse code https://github.com/paramat/driftcar

driftcar by paramat
For Minetest 0.4.16 and later. Compatible with Minetest 5.0.0-dev.
Depends: default

Licenses
--------
Source code: MIT
Media (textures and car nodebox): CC BY-SA 3.0

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
(343.71 KiB) Not downloaded yet
 

User avatar
Chiantos
Member
 
Posts: 304
Joined: Sun Jan 15, 2017 09:04
Location: Earth
GitHub: BlockColor
IRC: mrchiantos
In-game: mrchiantos

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

by Chiantos » Tue Oct 09, 2018 08:52

Hello,

Image

With Mesecar title for DriftCar, this best no ?

Good day
Attachments
2018_10_08_23.30.26.png
(209.72 KiB) Not downloaded yet
Game : BlockColor - Avatar Mod with Cms : SkinKey
 

Byakuren
Member
 
Posts: 816
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 » Tue Oct 09, 2018 21:58

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

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

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

by paramat » Fri Oct 12, 2018 03:09

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: 816
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 » Sat Oct 13, 2018 07:25

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

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

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

by paramat » Sat Oct 27, 2018 13:16

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.
 


Return to WIP Mods



Who is online

Users browsing this forum: alcatz, Exabot [Bot] and 8 guests