changing Physics::showDebug on-the-fly?

edited March 2013 in Help request
Was wondering if there was a way to programatically turn they physics debug outlines on and off (e.g. via a keystroke), or is it an ini-only type of thing?

I've tried the obvious places in the API:

Even grepped through the source. No luck.


  • edited March 2013
    To answer my own question:
    void Game::togglePhysicsDebug() const {
    void Game::setPhysicsDebug(bool enable) const {
    	orxConfig_SetBool(orxPHYSICS_KZ_CONFIG_SHOW_DEBUG, enable ? orxTRUE : orxFALSE );
    bool Game::getPhysicsDebug() const {
    	bool ret = orxConfig_GetBool(orxPHYSICS_KZ_CONFIG_SHOW_DEBUG);
    	return ret;
  • edited March 2013
    That is indeed the way to do it programmatically.

    Now if all you wanted to do was to do it on-the-fly in your game without having to modify the code, open the console and type:
    set Physics ShowDebug true
    set Physics ShowDebug false
    You can also add a command alias to make it easier, either at runtime via the console:
    Command.AddAlias psd set "Physics ShowDebug"
    Or via your config file:
    psd = set Physics ShowDebug
    And then use it in the console with:
    psd true
    psd false
    psd 1
    psd 0

    EDIT: You can also list all aliases in the console with:
  • edited March 2013
    Wow, okay. Didn't know there was a console. Couldn't figure out how to open it, son a whim I hit backtick (`), since that's where it is in so many other engines.

    Is that key-binding hard-coded in?
  • edited March 2013
    That's the default key but you can change it in config:
    ToggleKey = KEY_*; NB: Defines the toggle key for activating the in-game console;
    Any existing command can be executed in the console. I'm using it most of the time to check the current value of config properties, or to toggle FPS/Profiler/PhysicsDebug or even for creating new objects on the fly and testing a few things on them.
    One can also use it to make a full dump of the config values into a separate file or even for saving config data in their originating file after tweaking them (but in that case comments and text formatting will be lost).
Sign In or Register to comment.