PyObject *py_ue_get_hit_result_under_cursor(ue_PyUObject * self, PyObject * args) { ue_py_check(self); int channel; PyObject *trace_complex = nullptr; int controller_id = 0; UWorld *world = ue_get_uworld(self); if (!world) return PyErr_Format(PyExc_Exception, "unable to retrieve UWorld from uobject"); if (!PyArg_ParseTuple(args, "i|Oi:get_hit_result_under_cursor", &channel, &trace_complex, &controller_id)) { return nullptr; } bool complex = false; if (trace_complex && PyObject_IsTrue(trace_complex)) { complex = true; } APlayerController *controller = UGameplayStatics::GetPlayerController(world, controller_id); if (!controller) return PyErr_Format(PyExc_Exception, "unable to retrieve controller %d", controller_id); FHitResult hit; bool got_hit = controller->GetHitResultUnderCursor((ECollisionChannel)channel, complex, hit); if (got_hit) { return py_ue_new_fhitresult(hit); } Py_RETURN_NONE; }