What’s wrong with this camera setup? I tested not having a transform parent (used for easy centering), tested bypassing message system. Shouldn’t the camera always center on the object? Instead you can see it goes a little ahead.
Here is a more extreme example with click and drag accelerated scrolling to show how bad it gets !? Simple fix and I’m just doing something stupid I hope?
Ah, I see, yes, that sure looks weird, and I believe I’ve seen this in my own example as well. It’s caused by the use of a camera.script to send the view projection instead of a proper camera component. If you switch to a camera component and acquire camera focus the problem will go away. I did however find a solution that works when you use a script instead. If you do the view projection update after the update function instead of inside the update function of the camera.script you will get no jitter. Like this:
camera.script:
function update(self, dt)
if self.enabled == 1 then
msg.post("#", "update_camera")
end
end
function on_message(self, message_id, message, sender)
if message_id == hash("enable") then
self.enabled = 1
elseif message_id == hash("disable") then
self.enabled = 0
elseif message_id == hash("update_camera") then
local aspect_ratio = (self.auto_aspect_ratio == 1) and default_aspect_ratio or self.aspect_ratio
local projection = vmath.matrix4_perspective(self.fov, aspect_ratio, self.near_z, self.far_z)
....