+1 vote

Hello,

I have a problem with collision that triggers only so many times (approx. 1 in 20) and I'm not sure how to fix it.

I have an arrow with following rigid body:
Mode: Character
Mass: 0.01
Weight: 0.01
Gravity Scale: 0
Contacts Reported: 2
Contact Monitor: On
Can Sleep: On

The sphere I shoot at is coming down a slope (angled down by around 45 degrees) and I'm shooting at it from bottom of the slope.
Here are the sphere's rigid body properties:
Mode: Rigid
Mass: 1
Weight: 9.8
Gravity Scale: 1
Contacts Reported: 5
Contact Monitor: On

The arrow is shot using the method applycentralimpulse and the direction calculation is done using global_transform.basis.z (so that it fires towards the spheres)

On the arrow, I subscribe (connect) to bodyentered event (signal) and apply damage if I've hit a sphere. If it has no health, I use queuefree to remove it. Otherwise, I add knockback which is also just a call to applycentralimpulse, but this time on the sphere.

The physics FPS is set to 60.

Godot version 3.3.2.stable
in Engine by (16 points)

1 Answer

+2 votes
Best answer

Try using an area2d with a seperate collision shape (the hitbox) which is slightly larger that the collision shape of the rigid body

by (272 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 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.