Can someone tell me where I'm going wrong with space_state or intersect_ray

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bluemage
func raycast_from_mouse(m_pos, collision_mask):
	var ray_start = cam.project_ray_origin(m_pos)
	var ray_end = ray_start + cam.project_ray_normal(m_pos) * ray_length
	print("start", ray_start, "end" , ray_end)
	var space_state = get_world().direct_space_state
	print("space state=" , space_state)
	var ans = space_state.intersect_ray(ray_start, ray_end, [], collision_mask)
	print("ans" , ans)
	return ans


start(33.30286, 16.7134, 144.6586)end(-44.746288, -345.34787, -784.222412)
space state=[BulletPhysicsDirectSpaceState:1133]
ans{}
result={}

I’m not getting anything for the result of space_state.intersect_ray and I’m not sure why. any thoughts?

Post edited to fix code formatting. Please use four spaces in front of code samples, or click the “Code Sample” button when making your post.

kidscancode | 2019-06-02 21:20

I figured it out I was missing a static body and collision shape from create convex static body. just curious though is there a way to do that function with collada files?

bluemage | 2019-06-03 01:35