Large frame rate drop in scene on a hosted webpage versus running on localhost server

i did a quick profile and a mousemove is taking 6ms, plus a 50 ms function call inside every raf which seems to originate in your player update animations and ultimately in the then engine raf callback. I took a look at your player updates and its not really doing much except for calling the bt transforms.

check this out first

tldr: try doing scene.skipPointerMovePicking = true

if that doesnt work, take a look at the player updates:

_beforeRenderUpdate(): void {
this._updateFromControls()
this._animatePlayer()
}
^^^^
(this is what’s calling into thin engine and calling whatever is running 50ms per raf)

i’d check this first. also, i think you’re calling this twice in each input impl. like for keyboard, line 664 and again on 767.

  this._kinematicController.playerStep(
      this.game.physicsWorld,
      this._deltaTime / 1000,
    )
    
    tran = this._kinematicController.getGhostObject().getWorldTransform()
    tranPos = tran.getOrigin()

so, either the kinematicController.playerstep or the world transform. could be the world transform if you’re using a bt heightmap for that huge ass terrain? not sure how all that hooks up.

2 Likes