why do my character not get blocked on collision?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By flonkopaten
:warning: Old Version Published before Godot 3 was released.

Hello, i am new to Godot engine and i try to make a simple game with just a cube and a few walls. The cube is my character, and i use this script to make the movement.
func _fixed_process(delta):

if (Input.is_action_pressed("ui_up")):
	speed = speed - .5
elif (Input.is_action_pressed("ui_down")):
	speed = speed + .5
if (Input.is_action_pressed("ui_left")):
	rotate_y(-delta/.8)
elif (Input.is_action_pressed("ui_right")):
	rotate_y(delta/.8)
translate(Vector3(0,0,delta*speed))

very simple but works just like i want it to.
My problems is when i move this cube into my wall wich is like this :staticbody and the children is meshinstance and collisionshape.

The cube (character) is rigidbody with children meshinstance, collisionshape and a camera.

When move the character into the wall the wall blocks but not totaly, i mean if you still push the button it slowly goes through the wall.
How can i fix this?

Hi,

I got this problem with my player spawning above the floor, when contact with the floor, player slowly goes through it and stop after fews seconds. Sadly, I don’t remember how i wad fixing that ! You can activate debug collisions and try to check the normals and try to a simple floor test. If you want you can put your project here, I can check.

Nutr1z | 2017-01-10 15:05

:bust_in_silhouette: Reply From: eons

You should not move a rigid body with translate, those need to be moved by forces and controlled by the engine, look at the Platformer 3D demo to see how to simulate movement on a rigid body by controlling the body physic state.

ok thanks, i will check that.

flonkopaten | 2017-01-10 15:30

any advice on similar movement script with using forces, would be nice :slight_smile: i try check it myself but a bit new to this :slight_smile:

flonkopaten | 2017-01-10 15:35