0 votes


hope you can understand me.

I have project where i want to have an object/box where the player can walkthough(like no collision) it the first time, but when the player exited the object it will block/set collision. So you can only go though the object the first time, the next time it will be blocked.

i cant not make rigidbody2d and body_exited work.

Do you guys have a better idea


in Engine by (17 points)

Hi, could you share us some code?

2 Answers

+1 vote
Best answer

What I would do is use the collision layers and mask.

The setup would be a invisible wall, on a different layer, that the player first moves past. Then you use a Area node or some kind of event and enable the layer of the wall; now the player can't pass again.

For more on mask: https://godotengine.org/qa/4010/whats-difference-between-collision-layers-collision-masks

by (1,445 points)
selected by

Thank for the fast reply.

Yes that was what i was looking for.

I made a Node2D with a Area2D and RigidBody2D and then change the layer on RigidBody2D when exited the Area2D was exited.

func _on_Area2D_body_exited(body):

Thanks for the help

+1 vote

If you mean some sort of one way door, I guess you could give the Staticbody/Area2D Collision shape set to "trigger", and after your Rigidbody exits it, spawn a scene with normal collision shape(or change "trigger" to normal via script, I guess there should be way for it).

by (23 points)
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.