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