|Topic was automatically imported from the old Question2Answer platform.
I am having great confusion with this.
I simply want to detect when my bullet hits a player etc… they already have a momentum (i keep getting linked by google to “move_and_slide”)
So normally we have some physics callbacks somewhere… BeginContact, EndContact etc
So roughly: I have a missile flying with no resistance at a solid momentum, when it hits something i want to delete it, show and explosion and apply damage… i need to start by just a simple BeginContact callback
where do i do this… if there is no callback yet… how do i check for it in the integrate forces bit?
RigidBodys have a signal called
body_entered that is emitted when another body collides with it.
func _on_Bullet_body_entered(body): #connected to mentioned signal
#body is the other colliding body
if body == player: #assuming self is a bullet
#spawn an explosion
#deal damage to the player
RigidBody to even remotely emit this signal you must have
contact_monitor enabled and
contacts_reported must be one or more.
i was not aware of “contact_monitor” “contacts_reported” vars… so i have enabled these
you say though “connected to mentioned signal” how do i do this? this answer in itself doesn’t give me enough to detect the collision
DarkShroom | 2018-11-16 15:22
okay i figured maybe i didn’t understand signals… so had an extra look
i didn’t know you can set them up in the editor! duh
Thanks for your answer, thank god i don’t have to do anything fancy in intergrate_forces!
DarkShroom | 2018-11-16 15:35