Ok so I figured it out. The reason it was eluding me was that it was two separate things which led me to all the wrong conclusions. .
First setting inertia back to 0 (which makes it automatically compute inertia and clearly that's good enough)
Second one of the objects I was colliding with for testing had a strange wonky collision box. It was a slight rhombus although I saw nothing in its inspector to indicate why, and it was slightly scaled up. I am kind of amazed how such a seemingly tiny change had made that object into something that would teleport my tank to space every time I touched one of its corners (not in the video).
Kingstad
Posts
-
-
the process part is fair enough my bad, but I've tried all kinda of values in the inspector and there's no difference if they are set to single digits. Well I've tried changing all the physicsengine settings I could find but they didnt seem to change anything about the collision. Maybe this engine cant handle impulse or something
-
Hi there! I'm like many now transitioning from Unity to Godot 4.1 but I only quite recently started trying my hand at game developing (and code).
I am struggling to replicate everything I have in Unity like how my tank (RigidBody2D with collision polygon) behaves when colliding with something:
https://youtu.be/4Aj60v9hVLY
the rocks are static body but they behave the same if they are character body.
The tank is propelled by continuous force (impulse) when you press the controls.
I've tried changing various values in the inspector: mass, inertia, friction, damp, damp mode, disable mode..func control(delta): # Apply a force to the tank in the direction of the player's input. if Input.is_action_pressed("forward"): var impulse = Vector2(moveForce, 0).rotated(rotation) apply_central_impulse (impulse) if Input.is_action_pressed("back"): var impulse = Vector2(-moveForce/2, 0).rotated(rotation) apply_central_impulse (impulse) # Apply a torque to the tank in the direction of the player's input. if Input.is_action_pressed("turnRight"): apply_torque_impulse(rotationSpeed) if Input.is_action_pressed("turnLeft"): apply_torque_impulse(-rotationSpeed) func _process(delta): control(delta)
2D top down collision behavior
2D top down collision behavior
2D top down collision behavior