Newbiew got into a mess

Godot Version

4.2.2 Stqble

Hello all,
I’m new to Godot. Actually tried it a few year ago probably some version two.
Now as as “Hello World” project I’m recreating Space Taxi from the good old C64 days. I’m using node_3d for this since I want to expand the 3D stuff later.

Now I had everything running fine when I started to alter the taxi model in Blender. Then things went south.

Basically I just have a quite simple model for a taxi. A yello box with a few edges. I exported the model from blender to a glb file and use the import function in Godot. I imported the “Taxi1.glb” file as CharacterBody3D. The model also has a cube-colonly which the importer detects as CollitionShape3D. Then I save the imported model as taxi_1.tscn. But when inserting it into my Node3D it complains that the node has no shape. So it does not recognize the CollitionShape3D I guess. Because it I create one the warning disappears .
Also now the movements of the Taxi is totally weir. While it was good some imports a go.
The script is really simple. The game actually is on the Y and Z axis. I’ll change that later to be X and Y.

extends CharacterBody3D

const SPEED = 0.5
const DRAG = 1.0
const JUMP_VELOCITY = 1.5
var taxiDirection = "Left"

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")

func _physics_process(delta):
	# Add the gravity.
	if not is_on_floor():
		velocity.y -= gravity * delta

	# Handle jump.
	if Input.is_action_pressed("ui_up"): # and is_on_floor():
		velocity.y += JUMP_VELOCITY
	
	if Input.is_action_pressed("ui_down"):
		velocity.y -= JUMP_VELOCITY

	if Input.is_action_pressed("ui_right"):
		velocity.z -= SPEED
		if taxiDirection == "Left":
			taxiDirection = "Right"
			rotate_y(deg_to_rad(180))
			
	if Input.is_action_pressed("ui_left"):
		velocity.z += SPEED
		if taxiDirection == "Right":
			taxiDirection = "Left"
			rotate_y(deg_to_rad(-180))

	# Get the input direction and handle the movement/deceleration.
	# As good practice, you should replace UI actions with custom gameplay actions.
#	var input_dir = Input.get_vector("ui_left", "ui_right", "ui_accept", "ui_down")
#	var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
#	if direction:
#		velocity.x = direction.x * SPEED
#		velocity.z += direction.z * SPEED
#	else:
#		velocity.x = move_toward(velocity.x, 0, SPEED)
	
	#velocity.x = move_toward(velocity.x, 0, DRAG)
	#velocity.y = move_toward(velocity.y, 0, DRAG)
	velocity.z = move_toward(velocity.z, 0, DRAG)

	move_and_slide()

My impression is that something in the background is also acting on the movement of the Taxi object but I can’t find out what it could be.

Thank you for any suggestions on how I could solve this.

I’ve gotten a little bit further on this.
When I don’t have add CollisionShape3D to the imported model, the movements are OK. As soon as I add a CollisionShape3D the controls act weird. Without the CollisionShape3D the object does not collide with anything though.
I realized that there’s always a CollisionShape3D being imported even if I don’t add one with the -colonly suffix in blender. But it appears that Godot just ignores that collision shape.

Can you share a screenshot of your importer settings?

Hello,
trying to add the images now:


Also here’s the scene:
Screenshot 2024-07-22 at 20.47.55

Huh I’ve never used Root Type before, very cool!

Try removing the generated physics static body, a check box on Cube.

You can then add your own CollisionShape3D. In this case it’s a good idea to use a simple box, but for more complex models you can select the model and generate with the mesh tool here.

2024-07-22-135204_3840x1080_scrot

hmm… can’t quite follow what you are showing. My Godot does not have that “Mesh” tab next to the view.
Here’s a screenshot sowing the problem with the Node Configuration warning about the missing node shape:


Edit : I found now what you mean. I tried what you suggested but the movement of the Taxi is still really weird as soon as I add a CollisionShape3D. Also with “Create Single Convex Collision Sibling.” but thank you for the suggestion.

OK, got it now. I managed to remove the generated physics on the cube while importing the glb file. Then adding the “Create Single Convex Collision Sibling” on the cube. Now the movements of the taxi is correct again.
Still this feels kind of strange. I believed that one should be able to import collision boxes from Blender or is that only for static objects ?
Cheers.

1 Like

It’s used for static level geometry, I haven’t seen it used as part of character bodies.

A 3d character is often manipulated by an Armature with mesh deformations, so generating a collision shape is either useless or extremely expensive, or both!

It’s just not a typical use case, and has not been implemented that way. Usually a character body has no imported “Physics ” collision shapes, instead creating them as simple collision shapes like capsules or boxes, then attaching the simple collision shapes to a few select bones.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.