CharacterBody gravity vs RigidBody gravity

Godot Version

v4.6.2.rc1.official [257ac3532]

Question

This simple code for gravity:

func _physics_process(delta: float) -> void:
	if not is_on_floor():
		velocity += get_gravity() * delta

	move_and_slide()

and without other external forces, I assume that the acceleration due to gravity should be the same for CharacterBody and the RigidBody, but the result looks different:

3d

  • In both 2D and 3D, CharacterBody and Rigdbody show different results.
  • In 3D, I tested Jolt and GodotPhysics, and both showed the same behavior.

I’m using default settings, without any adjustments.

Is my understanding of gravity wrong?

How are you keeping the rigidbody in place? Looks to me like it’s accumulating acceleration

1 Like

CharacterBody got no mass, but RigidBody body have a mass, Soo the CharacterBody is just moving down at a fixed -9.8 speed, meanwhile the RigidBody is moving according to the physics.

(This is Wrong lol)

Gravity is independent from mass.

2 Likes

I believe that according to Newton’s law of universal gravitation, this is incorrect.

1 Like

I also don’t understand gravity xD
I was just thinking it should work.
(I am in 7th grade and I don’t know a lot about physics yet xd )

There is a default linear_damp = 0.1 applied to the RigidBody3D nodes, which makes them slightly slower over time compared to the CharacterBody3D. This is done to simulate friction.

You can change it either in the ProjectSettings or in the RigidBody3D settings directly.

https://docs.godotengine.org/en/stable/classes/class_projectsettings.html#class-projectsettings-property-physics-3d-default-linear-damp

If you change the linear_damp_mode to Replace and linear_damp to 0.0, you’ll see that both are falling at the same rate.

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