...
The script is for Y-based setups. If you have a Z-based axis setup you have to uncomment (remove the # characters) the appropriate code.
Code Block | ||
---|---|---|
| ||
import math
camera = scene.getCamera("SceneCamera01")
focusObject = scene.getObject("Cube01")
objectPosition = focusObject.getParameter("Position")
frame = scene.getCurrentFrame()
radius = 1.5
cycles = 3.0
verticalPosition = 0.5
orientation = 0
if (frame == scene.getMinFrame()):
camera.setParameter("LookAt", objectPosition)
if (orientation == 0): sign = 1
else : sign = -1
simRange = float(scene.getMaxFrames() - scene.getMinFrame()) - 1.0
degPerFrame = (360.0 / simRange) * cycles
radians = (sign * degPerFrame * math.pi / 180.0)
xCoord = math.cos(frame * radians) * radius + objectPosition.x
zCoord = math.sin(frame * radians) * radius + objectPosition.z
cameraPosition = Vector.new(xCoord, verticalPosition, zCoord)
# yCoord = math.sin(frame * radians) * radius + objectPosition.y
# cameraPosition = Vector.new(xCoord, yCoord, verticalPosition) |
...
camera.setParameter("Position", cameraPosition) |