ldc.camera.setThirdPerson API
2021-08-31, 9:20 (This post was last modified: 2021-08-31, 9:20 by David Manley.)
2021-08-31, 9:20 (This post was last modified: 2021-08-31, 9:20 by David Manley.)
(Probably for Roland but if someone else has worked this out, please chip in).
Context:
I'm trying to write a (Lua) animation script which will rotate the 3rd person view camera around the Y axis starting at the current view, rather than the start point used in the sample script. From the sample scripts, I can see the purpose of the first two arguments (helped by the description in LD4Studio documentation) but I'm struggling to understand the purpose next 3 angle (?) related arguments. The sample script in the function OnCameraFrame ...
... is applying an appropriate angle change to the third parameter. From playing around a bit, it seems that parameters three, four and five are related to a x, y, z coordinate. But even though the code applies the angle delta to the X value (I think), the camera appears to rotate around the Y axis. And that confuses me as I would have though that to rotate the camera around the Y axis would have required the angle delta to be applied to the y coordinate.
I'd appreciate it if someone could clear up my misunderstanding.
Regards,
David
Context:
I'm trying to write a (Lua) animation script which will rotate the 3rd person view camera around the Y axis starting at the current view, rather than the start point used in the sample script. From the sample scripts, I can see the purpose of the first two arguments (helped by the description in LD4Studio documentation) but I'm struggling to understand the purpose next 3 angle (?) related arguments. The sample script in the function OnCameraFrame ...
Code:
function onCameraFrame()
--Rotate a 3rd person camera around the center of the model.
local ani=ldc.animation.getCurrent()
local angle=ani:getFrameTime()/ani:getLength()*360
local cam=ldc.camera()
cam:setThirdPerson(camPos, camDist, angle+45, 25, 0)
cam:apply(0)
end
... is applying an appropriate angle change to the third parameter. From playing around a bit, it seems that parameters three, four and five are related to a x, y, z coordinate. But even though the code applies the angle delta to the X value (I think), the camera appears to rotate around the Y axis. And that confuses me as I would have though that to rotate the camera around the Y axis would have required the angle delta to be applied to the y coordinate.
I'd appreciate it if someone could clear up my misunderstanding.
Regards,
David