Search code examples
javascriptbabylonjs

How to refresh BabylonJs canvas?


How can I refresh the scene or canvas after I changed canvas size in BabylonJs? all I want is to re render the scene because the aspect ratio changes when the browser size is changed by the user.


Solution

  • It can be done using engine.resize() method. See: https://doc.babylonjs.com/classes/3.1/engine#resize-rarr-void