@@ -919,6 +919,40 @@ static PyObject *py_ue_enable_mouse_over_events(ue_PyUObject * self, PyObject *
919919 return Py_None;
920920}
921921
922+ static PyObject *py_ue_set_simulate_physics (ue_PyUObject * self, PyObject * args) {
923+
924+ ue_py_check (self);
925+
926+ bool enabled = true ;
927+
928+ PyObject *is_true = NULL ;
929+ if (!PyArg_ParseTuple (args, " |O:set_simulate_physics" , &is_true)) {
930+ return NULL ;
931+ }
932+
933+ if (is_true && !PyObject_IsTrue (is_true))
934+ enabled = false ;
935+
936+ UPrimitiveComponent *primitive = nullptr ;
937+
938+ if (self->ue_object ->IsA <UPrimitiveComponent>()) {
939+ primitive = (UPrimitiveComponent *)self->ue_object ;
940+ }
941+ else if (self->ue_object ->IsA <AActor>()) {
942+ AActor *actor = (AActor *)self->ue_object ;
943+ primitive = (UPrimitiveComponent *) actor->GetComponentByClass (UPrimitiveComponent::StaticClass ());
944+ }
945+ else {
946+ return PyErr_Format (PyExc_Exception, " unable to set physics for the object" );
947+ }
948+
949+ primitive->SetSimulatePhysics (enabled);
950+
951+ Py_INCREF (Py_None);
952+ return Py_None;
953+ }
954+
955+
922956static PyObject *py_ue_actor_components (ue_PyUObject * self, PyObject * args) {
923957
924958 ue_py_check (self);
@@ -1129,6 +1163,7 @@ static PyMethodDef ue_PyUObject_methods[] = {
11291163 { " set_view_target" , (PyCFunction)py_ue_set_view_target, METH_VARARGS, " " },
11301164 { " add_actor_component" , (PyCFunction)py_ue_add_actor_component, METH_VARARGS, " " },
11311165 { " get_actor_component_by_type" , (PyCFunction)py_ue_get_actor_component_by_type, METH_VARARGS, " " },
1166+ { " set_simulate_physics" , (PyCFunction)py_ue_set_simulate_physics, METH_VARARGS, " " },
11321167 { NULL } /* Sentinel */
11331168};
11341169
0 commit comments