Returning with more details for the sake of being thorough.
This is the function for creating a PhysicsShapeQueryParameters3D and checking its collisions later on in the code:
@onready var world = get_world_3d()
@onready var directSpaceState = world.get_direct_space_state()
var physicsShape = PhysicsShapeQueryParameters3D.new()
func createPhysicsShapeQueryParameters3D():
var shape = CapsuleShape3D.new()
shape.height = 15
shape.radius = 7
physicsShape.set_shape(shape)
#Self is alligned with the player's 0x,0y,0z position here
physicsShape.set_transform(Transform3D(Vector3(1,0,0),Vector3(0,1,0), Vector3(0,0,1), Vector3(self.position.x, self.position.y, self.position.z)))
physicsShape.collide_with_areas = true
#I have my hitboxes set to mask layer 5, and hurtboxes set to mask layer 6
physicsShape.set_collision_mask(0b00000000_00000000_00000000_00110000)
#Later in the script
func buttonPressed():
#This is how I'm getting the results of the above post. NOT using get_rest_info(), but instead intersect_shape() with my physicsShape and my object collision limit being 200
var print = directSpaceState.intersect_shape(physicsShape, 200)
print(print)
I am actually now moving on to a 2D physics system that will render in 3D, so this code will be a bit obsolete (mainly the Transforms) but still a useful resource for anyone unfamiliar with the PhysicsShapeQueryParameters3D type. I wouldn’t blame you! It’s confusing!