Having trouble with raycast

Good afternoon. I’m doing a pilot in a mech (like titanfall). I decided to do an obstacle check between the pilot and the vehicle using raycast. Ended up with a problem and can’t figure it out myself. I use the Platypus extension for basic mechanics. As a result, when raycast hits a fur collision it returns nil. At the same time, when raycast hits an obstacle, the table is returned. Can you give me a hint, please?

function on_input(self, action_id, action)
	if controll_player then
		if action_id == hash("left") then
			self.platypus.left(250)
		elseif action_id == hash("right") then
			self.platypus.right(250)
		elseif action_id == hash("change") and action.pressed then
			inject()
			--msg.post("/mech#mech", "change")
			--go.delete()
		elseif action_id == hash("jump") then
			if action.pressed then
				self.platypus.jump(400)
			elseif action.released then
				self.platypus.abort_jump(0.1)
			end
		end
	end
end
local function inject()
	my_groups = {hash("mech"), hash("ground")}
	local from_pilot = go.get_world_position("#factory_pilot")
	local to_mech = go.get_world_position("/mech/mech_inject")
	local result = physics.raycast(from_pilot, to_mech, my_groups)
	print("Result ID:", result)
	local distance = from_pilot - to_mech
	if math.abs(distance.x) <= 30 and math.abs(distance.y) <= 30 then
		msg.post("/mech/mech#mech", "change")
		go.delete()
	end
end

image

I don’t really understand what the problem is? Ray casts return a table with hits or nil if there are none:

The thing is, there should be a hit, but for some reason there isn’t. If you go deeper, it even worked partially at first. But there was a similar problem when the characters were on the same level. I think this is due to the fact that for the pilot and mech is used platypus. I also create the pilot through factory. Unfortunately I don’t have enough experience to know where to dig.

Start by enabling physics debugging: Debugging in Defold

Are the collision objects where you expect them to be? And are you sure about their groups?

It worked. I changed the collision type. And everything started working, with everything available. Thank you very much!