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

Like I am calling the area entered signal function. For projectile and also melee attacks.
Was wondering if there's a easy way to tell where the collision shape of the entering area 'entered' the collision shape of the character.

What's the easiest way to find that out? Is there a built in variable for this? Or do I need to do some custom calculation for the variety of different projectile sizes?

Godot version 3.4.4
in Engine by (208 points)

1 Answer

+1 vote
Best answer

You could go about it in different ways. Lets say the area entering the area of the player is a small one, say of a bullet. Then you can emit the area entered signal from the bullet, and send with it the global position of the bullet. Then if the object recieving the signal also knows the global position of the player, you can calculate the difference, and what you get is the local position of the bullet, relative to the player.

If the area is a bigger one, you can do the same thing of course, but the position you end up getting might not end up being so close to the area of the player.

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