I am coding without the playcanvas editor, so I don’t use
createScript at all. Rather I use the
update handler from pc.Application. Almost all of my objects have a reference to the pc.Application, so they can all attach their own handlers to the
My question is (this really applies to any engine) what should go in to the update handler and what shouldn’t?
For example, I created a first person camera. I added handlers outside of the
update handler for
keydown that calls
camera.setPosition(x, y, z). But for rotating the camera I call
this.camera.setLocalEulerAngles() within the
update handler if free look has been enabled (bool check).
So I did camera movement outside of the update event and camera rotation within. They both seem to work. What is the general guideline? What if I want to just move an object around, does that go in the update event ?