Hello all!
I am trying to create an area 3d that is a sphere and I want to get any bodys that are entered in, but I am having issues actually spawning the body and collision shape, I have printed the positions and they are the same as the block instance, since I can see the block but not the area somethings wrong with the area code, I enabled debug collision shape so I can see collisions and I dont see it any were, I would love for someone to see what mistake I have made, oh and also I cant seem to get the connect signal to work either because its not detecting anything or I did something wrong.
Code:
func create_area_sphere(pos : Vector3):
# Create an area and collision shape for it
var area = Area.new()
var collision_shape = CollisionShape.new()
# Create a shape for the collision
var sphere = SphereShape.new()
sphere.radius = 2.1
sphere.margin = 0.04
# Set the shape to the collision
collision_shape.shape = sphere
# Test to see if its actually working just instancing a block at the position
var instance = block.instance()
get_parent().add_child(instance)
instance.translation = pos
####
#Add the are to the main scene
get_parent().add_child(area)
# Set the translation to the position
area.translation = pos
#Add the collision shape to the area as a child
area.add_child(collision_shape)
# Connect body entered signal to print_body
area.connect("body_entered",self,"print_body")
# Delete it when I am done with it
area.queue_free()
# Doesnt print anything
func print_body(body:Node):
print(body)
print("nothing")