3dcheapskate opened this issue on May 09, 2014 · 21 posts
3dcheapskate posted Tue, 20 May 2014 at 5:24 AM
Finally got there. This seems to do what I want
cam = scn.ActorByInternalName("MAIN_CAMERA") # Could use "AUX_CAMERA" instead
if cam:
xd=cam.Parameter("dollyX").Value()
yd=cam.Parameter("dollyY").Value()
zd=cam.Parameter("dollyZ").Value()
rx=cam.Parameter("pitch").Value()
ry=cam.Parameter("yaw").Value()
# Empirically derived offset of camera viewpoint from camera dollyX/Y/Z position
# (appears to be a fixed value independent of any other camera parameters - same in Poser 6/9)
Dz = 1.1
# The camera viewpoint position with x/y/zOrbit all zeroed would be...
x0=xd
y0=yd
z0=zd+Dz
# ...and converting these to polar coordinates
E0 = todegs(math.atan2(-y0,z0))
A0 = todegs(math.atan2(x0,z0))
D0 = math.hypot(y0,math.hypot(x0,z0))
# yOrbit/xOrbit values are simply added to polar azimuth/elevation respectively...
Ec=E0+rx
Ac=A0+ry
if Ec > 90:
Ec=180-Ec
Ac+=180
if Ec < -90:
Ec=-180+Ec
Ac+=180
Dc=D0
# ...and convert back to cartesian. This is where the main camera viewpoint is located
yc=-Dcmath.sin(torads(Ec))
d=Dcmath.cos(torads(Ec))
xc=dmath.sin(torads(Ac))
zc=dmath.cos(torads(Ac))
# Move Dolly camera to this point
dcam = scn.ActorByInternalName("STD_CAMERA")
if dcam:
dcam.Parameter("dollyX").SetValue(xc)
dcam.Parameter("dollyY").SetValue(yc)
dcam.Parameter("dollyZ").SetValue(zc)
# Dolly camera yaw/pitch are set the same as the Main camera's yOrit/xOrbit
dcam.Parameter("pitch").SetValue(rx)
dcam.Parameter("yaw").SetValue(ry)
dcam.Parameter("roll").SetValue(0.0)
Cheers,
Pete
The 3Dcheapskate (also available in DAZ and HiveWire3D flavours) occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.