switch Physics Draw Mode

Switching works badly. It can switch, and maybe not. And it depends on the position of the cursor. Although, in the example of Cannon everything works. Why?

local physics = require('physics') physics.start() physics.setDrawMode('hybrid') physics.drawMode ='hybrid' local r=display.newCircle( 200, 200, 200 ) physics.addBody( r,"static") Runtime:addEventListener('key', function(event) local key = event.keyName if event.phase == 'down' then if key == 'd' then if physics.drawMode == 'normal' then physics.setDrawMode('hybrid') physics.drawMode = 'hybrid' elseif physics.drawMode == 'hybrid' then physics.setDrawMode('debug') physics.drawMode = 'debug' else physics.setDrawMode('normal') physics.drawMode = 'normal' end print('draw mode - ' .. physics.drawMode) end end end)

There’s no problem with the code that you’ve provided. It works exactly as intended. It also has nothing to do with the location of your cursor. That function is activated by pressing down the key “d”.

If you have some problems with your own code, please post it and explain what you did, what you expected to happen and what actually happened.

There’s no problem with the code that you’ve provided. It works exactly as intended. It also has nothing to do with the location of your cursor. That function is activated by pressing down the key “d”.

If you have some problems with your own code, please post it and explain what you did, what you expected to happen and what actually happened.