EDIT: disregard, this is fixed there was a problem during update with the camera using world positioning instead of position in relation to parent.
Scenario:
Perspective camera with rotation (22.5, 0, 0) and position (0, -210, 500)
Camera child of blank object, “selected”, that moves to the selected vector in the game world via left clicking (for animating the transition)
Camera can Zoom along Z axis
Code: edit fixed pseudo code to actual code
if action_id == hash("select") then
if action.released == true then
--Transform from screen clicked space to world position
local cursorTransform = rendercam.screen_to_world_plane(action.screen_x, action.screen_y, vmath.vector3(0, 0, 1), vmath.vector3(0, 0, 0))
--ID's for selected GO
local selectedID = go.get_id("selected")
--animate the transition from the old selected node to the new
local duration = 0.35
go.animate(selectedID, "position", go.PLAYBACK_ONCE_FORWARD, vmath.vector3(cursorTransform.x, cursorTransform.y, 0), go.EASING_LINEAR, duration, 0, landed.selected)
end
end
Results:
The camera doesn’t center the selected node in the display.
The Y centering skews based on Z changing, as the perspective is different.
Desired Results:
Have the camera center the selected node in the display regardless of Z position.
I have tried countless things I wouldn’t even know where to start. The only solution I have found is to hardcode the zoom levels and the camera positioning at those levels, but I would like it to be dynamic so we can change resolution and have it compensate Y automatically based on the perspective.