fenomas / noa

Experimental voxel game engine.
MIT License
611 stars 87 forks source link

Customized cameras and physics backtracking #114

Closed terrac closed 4 years ago

terrac commented 4 years ago

I'm getting a small amount of shakiness when I implement a custom camera

I'm overriding the function at g.camera.updateBeforeEntityRenderSystems and using g.ents.setPosition(g.camera.cameraTarget,cameraPos)

I'm thinking that somehow this and physics backtracking don't match. I'm wondering if there is anything obvious I am doing wrong

Thanks

fenomas commented 4 years ago

Hi, yes that definitely sounds like temporal aliasing due to the physics backtracking not lining up with the camera's motion. If you drive your camera by having it tied to a physics entity (which you move around with forces and impulses), I'd guess that should fix it. But if you want to move the camera arbitrarily by some other logic, you'll need to do your own backtracking similar to this.

terrac commented 4 years ago

Attaching a physics entity worked pretty well.