Hi,
I am trying to cast a ShapeCast3D using code
Doing this with a ray cast is simple enough:
func _physics_process(delta):
var query = PhysicsRayQueryParameters3D.create(position, position + Vector3(0, -10, 0))
var collision = get_world_3d().direct_space_state.intersect_ray(query)
But for the life of me, I cannot figure out how to do something similar with ShapeCast3D and I can't find any examples online to go off of. Here is code I have attempted to use (I have no idea what I'm doing 🙂
func _physics_process(delta):
var space_state = PhysicsDirectSpaceState3D
var thing = PhysicsShapeQueryParameters3D.new()
thing.set_shape(PLAYER_SHAPE)
thing.motion = Vector3(0,1,0)
space_state.intersect_point(thing)
ERROR: (Cannot call non-static function "intersect_point()" on the class "PhysicsDirectSpaceState3D" directly. Make an instance instead.)
How could I create a ShapeCast3D using GDScript that returns with the intersection point?