The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Hello Everyone,

I have a chest that I want to open went the player casts a spell(bullet).

The chest is a staticbody2d node and the bullet is an area2d node.

The bullet disappears easily when colliding with the chest. Now I want that the chest detects that collision and opens up (play the open animation).

I can't seem to find out how that should happen since I can't see any signals in the static body that can help me.

I'd appreciate any directions.

Thank you.

Godot version 3.3
in Engine by (27 points)

2 Answers

0 votes

Did you add a CollisionShape2D and set its shape in the inspector?

Also check this

by (810 points)

I did.

As far as I understand from the thread you mentioned, it's not an ideal way to do it. ( Or have I missed the point)

I'm having a super weird problem. If the make my chest into an area2d node the player stops colliding with it. The bullet works but so do all the objects that have a collision box.

If the keep it an area staticbody2d node I don't know how to have it interact with the bullet.

How can I specify just this

If the bullet collides with object -> object shakes

0 votes

You need to connect the "body_entered" signal on the Area2D.

Emitted when a PhysicsBody2D or TileMap enters this Area2D. Requires monitoring to be set to true. TileMaps are detected if the TileSet has Collision Shape2Ds.

PhysicsBody2D is inherited by Area2D

by (33 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 Frequently asked questions and 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 [email protected] with your username.