Ability to change physics type & settings in BGE Python
It would be very helpful to change an objects physics type and its settings via Python (and maybe also with a logic brick) .
Currently, you can't edit them during the game runs, which is very restrictive . An example: You have an object which is static. You wan't to move this, but it shouldn't nudge other objects whilst moving ( No Collision or Ghost has to be activated whilst moving the object). Therefore you must change the object because you can't change the physics type. After moving it, you could change the physics type back to static.
But why is the solution above not sufficient? Let me give you another example: the object has properties and changing the object would delete them if you don't save them.
That's why we need Python commands (or a logic brick) for this .
Here are a few suggestions:
(
own = bge.logic.getCurrentController.owner
)
| Function | Command |
|---|---|
| change pyhsics type |
own.setPhysicsType()
|
| set actor |
own.setActor(True/False)
|
| set ghost |
own.setGhost(True/False)
|
These are only a few suggestions, so please feel free to post your own suggestions as a comment. The table is also not complete, but I think is is enough to show you what my idea is.
Thank you
2 Comments
Additionally, we should enable the UI options in the setParent() command. In the UI, you can let the child deviate from the parent, but not in the Python API or in the game engine
might be great in those situations where you want a thing to be sensor and later be something else.. on the other hand if we want that then why not have a node type will possible options instead.