0 votes

Ok so i want to make a platformer game. I made a KinematicBody2D which can move horizontaly. I added to it a collision shape(rectangle) and a sprite.
I made a new scene where i put every tile and assigned to it a RigidBody2D and,
as a child of RigidBody2D, a CollisionPolygon2D modified by me
I did this to every tile in the game.
Converted that scene into a tileset, added to my game a tilemap.
I made the level but i have a major problem. When moving, my character just passes through walls and ground.
Because of that, i added to the world an Area2D node, assigned some CollisionShape2D's(rectangles) for the ground and the walls. Now the player stops only when colliding to the ground, but passes through walls. Checked if the depth's are the same and they are.
Strange problem, never happened to me.
(Sorry for my english)

in Engine by (402 points)

3 Answers

+3 votes
Best answer

Ok, sorry for the last answer.... I still can not imagine your scene.

Other tests:

1- If you are using rigidbodies to make scenary collision objects, probably this invisible objects fall down to the infinite.y position by gravity effect. Put a sprite inside the rigidbodies to test that And if the objects fall down, change "mode" to static or replace with staticbody2D. (put the sprite inside- this is important, if rigitbody is child of any visible object, this object can stay at the place and the rigidbody down, and you donĀ“t notice that)

2-If you are using a Area2D to stop physics movement think that this is not the aim for this node. You should replace the area by a Staticbody2D and it should work. You can put several collisionpolygons inside and if is not "trigger", it stops kinematicmovement (if layer mask is correct)

by (333 points)
selected by

Finnaly works. The problem was me xD. For the ground i put StaticBodies and for the walls i put RigidBodies xD.(changed them to static and worked well) That was just my fault.
Thank you! I almost wanted to abandon the project

0 votes

You do not provide enough information to solve your problem. Try to check if the collision shapes have "trigger check" on or off. Then check in which "physics layers" are the objects that have to collide and which "physics layers" mask. Some of those things should be.

by (333 points)

All collision shapes have exactly the same settings.
They are default
What is trigger? Should be on or off? Tried both ways and nothing

+2 votes

How about you try changing RigidBody2D to StaticBody2D and see if it works?

by (29 points)

Already solved ;)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.