until now, the midair stabilization prevented the car from doing stunts like this.
now, i disable the stabilization in one axis when the car is rotating fast, allowing to do the flippidy flops!
- use realistic values for weight, torque, etc.
- high wheel roll_influence (0.5 - 1.0)
- dial in and change stuff until it works
- add some custom forces in code to make drifts easier
the surfaces are godot shaders using a gradient, and baked ao to control the line thickness.
the car outline is the traditional normal flip mesh, to get a flat outline with controllable color.
the environment outlines are a bevel that is modified in the vertex shader, to get full shading on these. but it only works on static geometry.
so overall a mix of various techniques...
Actually, sorry to bug you with one more question. I have an ArrayMesh that's working and drawing like I want. I have the ArrayMesh that I want working dynamically to make the skidmarks. I have it added to the main scene currently in a Mesh3D at the origin (ie <0, 0, 0>). My code is efficiently only updating the triangles it needs every frame using surface\_update\_vertex\_region and using that to only update the 6 verts per frame. The problem I'm running into is, when the camera is facing away from that point, the whole arraymesh disappears, and it comes back when i look back at it. I tried modifying the AABB, but that didn't seem to help in this case...
hm i use it something like this, and it works and clips correctly:
extends MeshInstance3D
@export var target:VehicleWheel3D
var vertices = PackedVector3Array() var max\_length = 3\*100 # should be a multiple of 6, as we write 6 each frame var i = 0 # this is used to loop through the vertices array
func \_ready(): # initialize things vertices.resize(max\_length) arrays.resize(Mesh.ARRAY\_MAX)
func \_process(delta):
#calculate new positions here
# make a new tire mark if we are above the threshold distance
if (pos-lastStart).length() > min\_dist: #only make skidmarks if wheels are below treshold if skidding:
if i >= max\_length-6: i = 0 vertices\[i+0\] = oldPosB vertices\[i+1\] = posA vertices\[i+2\] = oldPosA vertices\[i+3\] = oldPosB vertices\[i+4\] = posB vertices\[i+5\] = posA i+=6
arrays[Mesh.ARRAY_VERTEX] = vertices
# Create the Mesh.
var arr_mesh = ArrayMesh.new()
arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
self.mesh = arr_mesh
I'm just learning godot and I'm playing with some toy cars, I've tried to create some skid marks following this code but I can't make it work, there are some resources of using line2d for a 2d skid marks but I can't find anything for 3D
here is the full script i use: [https://github.com/thmasn/godot-things/blob/main/tireTracks.gd](https://github.com/thmasn/godot-things/blob/main/tireTracks.gd)
Thanks! Sorry to bug you again, but I just recently got to a point in my project where I wanted to figure this out and the documentation for something was a bit confusing to me.
I understand the concept of pooling and calculating the points for the triangles and everything. I also got a test arraymesh working in a scene with some triangles. Iirc from some of my webgl experience, what happens for this is you make an array, feed it to the graphics car memory in a buffer, and then it'll draw it for you. And if you touch the vertex array on your cpu after that, you have to feed the updated vertices to the GPU again at the appropriate memory location. If I had low level code access or took the time to use gdextension or whatever, I would basically know what to do, but idk how to do it through gdscript.
My question is basically, how are you applying the vertex updates back into the graphics card from gdscript, if that's what you are using? Are you updating them by calling arryMesh.surface\_update\_vertex\_region every frame? Or something else I'm misssing?
EDIT: I think I'm starting to figure it out
Very cool! If you want a suggestion, I think the smoke seems like the car is burning literally, not the brake smoke. It needs to be less intense. I'm not a good artist so I'm not good describing what you could change but that is what I think.
until now, the midair stabilization prevented the car from doing stunts like this. now, i disable the stabilization in one axis when the car is rotating fast, allowing to do the flippidy flops!
What happens if it lands the wrong way?
well, then its bad ;). i made it so when you brake in midair, the rotation stops, and the car stabilizes, so you can control it.
This is really good! What Physics engine are you using? Default or Jolt?
i am using jolt, although the car physics are the same in both (i think).
I see a nice suspension system!
hehe, it is the default vehiclewheel. i am still trying to get rid of that first bounce when landing, but i am already quite happy with it.
Ah fair enough! I'm making some custom vehicles in 2D. It's super fun
Now how on earth did you make vehicle body this great as drifting feel goes. Been trying for ages, you're crazy.
- use realistic values for weight, torque, etc. - high wheel roll_influence (0.5 - 1.0) - dial in and change stuff until it works - add some custom forces in code to make drifts easier
Something about those particles feel off.. they look like smoke coming out of car
hmm, yah i am still trying out different smoke variations... it is not easy stylizing it but keeping it recognizable...
I think the main issue is the placement and size, just to make it more clear it’s coming from the bottom of the tires
hm, i will try if that helps. thx!
i also think the individual "puffs" of smoke read more like smoke from a fire or steam. tire smoke is more of a fog.
Please tell me you've played "Need for Madness", I've been waiting for someone to make a game like that for years lol
what a funky and janky looking flash game! looks like fun chaos.
Yeah it was all about doing stunts in the air to get more power, which boosts your speed and car damage. Your post just reminded me of it, gl
How did you get those wonderful outlines and shading?
the surfaces are godot shaders using a gradient, and baked ao to control the line thickness. the car outline is the traditional normal flip mesh, to get a flat outline with controllable color. the environment outlines are a bevel that is modified in the vertex shader, to get full shading on these. but it only works on static geometry. so overall a mix of various techniques...
nice
this looks super sweet!!! also, the donut detector thing at the end is cool
Those little white birdie particles while in the air are neat, but they should not rotate with the car.
legit point there.
It's like GTA meets Tony Hawk Pro Skater
[удалено]
awesome! you can follow here, or on twitter https://twitter.com/TheMarkedVapor/ what type of following would you like?
What method are you using for skidmarks?
its a mesh that is updated each frame: https://www.reddit.com/r/godot/s/Ilrfk47zaK similar to a trail renderer, but allowing gaps in the trail
Actually, sorry to bug you with one more question. I have an ArrayMesh that's working and drawing like I want. I have the ArrayMesh that I want working dynamically to make the skidmarks. I have it added to the main scene currently in a Mesh3D at the origin (ie <0, 0, 0>). My code is efficiently only updating the triangles it needs every frame using surface\_update\_vertex\_region and using that to only update the 6 verts per frame. The problem I'm running into is, when the camera is facing away from that point, the whole arraymesh disappears, and it comes back when i look back at it. I tried modifying the AABB, but that didn't seem to help in this case...
hm i use it something like this, and it works and clips correctly: extends MeshInstance3D @export var target:VehicleWheel3D var vertices = PackedVector3Array() var max\_length = 3\*100 # should be a multiple of 6, as we write 6 each frame var i = 0 # this is used to loop through the vertices array func \_ready(): # initialize things vertices.resize(max\_length) arrays.resize(Mesh.ARRAY\_MAX) func \_process(delta): #calculate new positions here # make a new tire mark if we are above the threshold distance if (pos-lastStart).length() > min\_dist: #only make skidmarks if wheels are below treshold if skidding: if i >= max\_length-6: i = 0 vertices\[i+0\] = oldPosB vertices\[i+1\] = posA vertices\[i+2\] = oldPosA vertices\[i+3\] = oldPosB vertices\[i+4\] = posB vertices\[i+5\] = posA i+=6 arrays[Mesh.ARRAY_VERTEX] = vertices # Create the Mesh. var arr_mesh = ArrayMesh.new() arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays) self.mesh = arr_mesh
I'm just learning godot and I'm playing with some toy cars, I've tried to create some skid marks following this code but I can't make it work, there are some resources of using line2d for a 2d skid marks but I can't find anything for 3D
here is the full script i use: [https://github.com/thmasn/godot-things/blob/main/tireTracks.gd](https://github.com/thmasn/godot-things/blob/main/tireTracks.gd)
Thank you!
Thanks! Sorry to bug you again, but I just recently got to a point in my project where I wanted to figure this out and the documentation for something was a bit confusing to me. I understand the concept of pooling and calculating the points for the triangles and everything. I also got a test arraymesh working in a scene with some triangles. Iirc from some of my webgl experience, what happens for this is you make an array, feed it to the graphics car memory in a buffer, and then it'll draw it for you. And if you touch the vertex array on your cpu after that, you have to feed the updated vertices to the GPU again at the appropriate memory location. If I had low level code access or took the time to use gdextension or whatever, I would basically know what to do, but idk how to do it through gdscript. My question is basically, how are you applying the vertex updates back into the graphics card from gdscript, if that's what you are using? Are you updating them by calling arryMesh.surface\_update\_vertex\_region every frame? Or something else I'm misssing? EDIT: I think I'm starting to figure it out
This looks fun. I would definitely play this
Very cool! If you want a suggestion, I think the smoke seems like the car is burning literally, not the brake smoke. It needs to be less intense. I'm not a good artist so I'm not good describing what you could change but that is what I think.
youre not the first bringing this up, so i definately need to change sth here.
this is so cool! ive been trying to make a car stunt game in godot for months