Why do my Area objects repel each other? I.e. why can't they pass through each other without being affected by physics? How do I make them be able to pass each other through?
The blue solid spheres seen here are RigidBodies with their own CollisionShapes. The large outer "invisible" spheres are the CollisionShapes of the areas attached to the RigidBodies. I'm expecting that the RigidBodies should not be able to pass each other through. I do however expect the large collisionShapes to pass each other through.
Below is the custom script that defines the RigidBodies with the Area and CollisionShapes attached. The two ball-entities seen in the GIF are instances of this script.
# Cell.gd: Custom script that is not attached to a Node.
# Is instanced in Spatial.gd below
# create shapes
outersphere = SphereShape.new()
outersphere.radius = 4.0
innersphere = SphereShape.new()
visualsphere = CSGSphere.new()
# create collision shapes
collisionshape_inner = CollisionShape.new()
collisionshape_outer = CollisionShape.new()
# add collisionshape_inner as child to rigidBody
# add an area to the rigidBody
area = Area.new()
# add collisionshape_outer to the area
# add visualshape to rigidbody
The main scene is a Spatial.tscn, with the following attached script:
# Spatial.gd. Attached as a script to a Spatial node in the
# node tree and main scene
var Cell = load("res://Cell.gd")
var zygote = Cell.new()
var zygote2 = Cell.new()
zygote.translation = Vector3(-20,0,0)
zygote2.translation = Vector3(20,0,0)
var v_21 = zygote.translation - zygote2.translation
var v_12 = -v_21
zygote.add_central_force( v_12*1 )
zygote2.add_central_force( v_21*1 )