



Reply From: 
Bartosz 
First retrieve list of overlapping boddies var bodies = area.get_overlapping_bodies()
Then check if boddies contains your body of interest if bodies.has(my_rigidbody): do_some_stuff();
Then check if boddies contains your body of interest if
bodies.has(my_rigidbody): do_some_stuff();
Bartosz, I do not need to check for intersection with a particular body (a scene node), but make sure that the intersection has occurred with any RigidBody. How to do it?
DimitriyPS  20180328 07:41
just check area.get_overlapping_bodies().empty()
true
means there are no overlapping bodies, false
means there is at least one overlapping body
Bartosz  20180328 19:10
Bartosz, that’s not what I wanted. I want to know the body type (node type) with which the intersection occurred (what this body: RigidBody, KinematicBody, StaticBody, etc.).
DimitriyPS  20180329 07:12
are yout asking about type check like this if body is RigidBody2D: do_something()
?
Bartosz  20180329 19:02
are yout asking about type check like this if body is RigidBody2D:
do_something() ?
I don’t speak English. Probably… Yes.
I need:
 check check intersection with Area (true/false)
 If the intersection eat to check the body type, with which intersected Area
This is how it worked in Godot 2.X:
if lp_Testor.get_overlapping_bodies().size()>0:
var n=0
for n in range(lp_Testor.get_overlapping_bodies().size()):
if lp_Testor.get_overlapping_bodies()[n] extends RigidBody:
lp_Testor.get_overlapping_bodies()[n].apply_impulse(Vector3(),Vector3(lp_Testor.get_overlapping_bodies()[n].get_mass()*4,0,0))
marker_Deystvie=4
lp_OstatokVremya=lc_Ogidanie_2
In Godot 3.X it does not work.
DimitriyPS  20180330 07:27
I’ve removed unnecessary if
, replace indexing by number n
with directly iterating elements and I’m using is
instead of extends
rest is your code:
for body in lp_Testor.get_overlapping_bodies():
if body is RigidBody:
body.apply_impulse(Vector3(),Vector3(body.get_mass()*4,0,0))
marker_Deystvie=4
lp_OstatokVremya=lc_Ogidanie_2
Bartosz  20180330 18:12