kidscancode / godot_recipes

Lessons, tutorials, and guides for game development using the Godot game engine.
MIT License
239 stars 37 forks source link

[Discussion] 3D Kinematic Car: Base #41

Open cbscribe opened 3 years ago

cbscribe commented 3 years ago

Discussion for http://godotrecipes.com/3d/kinematic_car/car_base/

v-pun215 commented 3 years ago

The .gob file I import has no texture. (Blacked out) can you help me?

v-pun215 commented 3 years ago

Please help me

cbscribe commented 3 years ago

Do you mean the .glb file? That's the binary GLTF file extension.

I'm not sure what could be causing it - it just works when I drop it in Godot. If it's black, it's not just that the texture isn't loading, so I'm wondering if it's a rendering issue. That would imply it's a video card/driver problem. Do you have any problems with other 3d assets?

v-pun215 commented 3 years ago

Yeah.... I meant the glb file. And I have not been able to import ANY 3d assets. Tried every format, old and new. Even from blender it does not work

v-pun215 commented 3 years ago

I only use Godot because Unity is a bit complicated or I would have switched to unity

cbscribe commented 3 years ago

Well, like I said, it sounds like the problem is with your computer and not Godot. Maybe you can update your video driver. Sorry, but there's not much more I can offer you.

v-pun215 commented 3 years ago

No. I installed Unity and 3d assets work just fine

WSPluta commented 3 years ago

Hey,

I have used your tutorial to create a mini game. I have tried to replicate it for a model that Im using. However when I run it I keep getting

E 0:00:01.083   set_axis_angle: The axis Vector3 must be normalized.
  <C++ Error>   Condition "!p_axis.is_normalized()" is true.
  <C++ Source>  core/math/basis.cpp:980 @ set_axis_angle()
  <Stack Trace> Car.gd:47 @ calculate_steering()
                Car.gd:30 @ _physics_process()

which is pointing at front_wheel += velocity.rotated(transform.basis.y, steer_angle) * delta and calculate_steering(delta)

any ideas?

cbscribe commented 3 years ago

It seems your transform.basis.y is not normalized. Perhaps you've done some other transforms to your model, such as scaling it? You can try normalizing the value: transform.basis.y.normalized()

peter-rocchio commented 2 years ago

Thank you for this tutorial, I fund it extremely helpful. One issue I came across was that the car seemed to "snap" too much when I let off the steering while drifting and it felt very strange.

The issue was alleviated by adding a target steer angle and having the input control that variable directly, then interpolating from the current steer angle to the target steer angle before adding it to the front wheel. This causes the front wheels to have a turn rate rather than snapping and really smooths out changes in direction, which feels much better in general.

I found that lerping or moving towards (of the steer limit) by about 20% seems like a nice middle with plenty of wiggle room.

daxtrajero commented 2 years ago

I've imported my own model, but its facing south instead of north. In the imported model's scene, i've transformed its Y 180degrees so its facing the right way.

When I import it into the main scene and I press UP ARROW the object moves backwards instead of forwards

any idea how to rectify this?

UPDATE: I've now fixed this. Newbie mistake. The imported model was saved as a scene with root node KINEMATIC BODY. I introduced a SPATIAL and did the transform Y 180 on that instead of the KINEMATIC node.

idbrii commented 1 year ago

The car in the 3d_car_tutorial releases zip doesn't stop and holding brake doesn't reverse (no local changes, on Godot 3.5.1). I'm not entirely sure what's wrong.

I ported the 2D car behaviour to a 3D car and got a car that works well: https://gist.github.com/idbrii/ba09735d9883a1ffb807c7df435eaefd

Thanks for the great tutorial!