Enivob
04-11-2003, 03:34 PM
Hi,
I have a max script that does camera cuts. Basicaly you put a bunch of camera in the scene, then run the script and it makes a new camera that cuts between all the others. I want to enhance this so it can cut between animated cameras, this is where I am running into problems.
I am trying to get the position of an object that has its position derived from a path position controller.
I assumed that I could simply "poll" the object at any given frame to get the position of the object on the path at that frame. But this is not working, I always get the same value no matter what frame I move to before I "poll" the object.
Here is some code... perhaps someone can see my obvious mistake.
obj_array = $* as array
s=0
frameCount = animationrange.end
frameStep = frameCount / objCount
--Create the camera and the target for the camera.
camTarget = targetobject position:[0,0,10]
newCamera = targetcamera pos:[0,0,0] target:camTarget name:"CutCam"
newCamera.target.name = newCamera.name + ".Target"
-- Create and assign new controller.
ctrl = bezier_position ()
newCamera.pos.controller = ctrl
trgt = bezier_position ()
newCamera.target.pos.controller = trgt
for obj in obj_array do
(
result = case superclassof obj of
(
Camera:
(
-- Animate the camera.
for n = s to (s + frameStep) do
(
at time n
k = addNewKey ctrl n
-- Here is the problem line, even though I am at frame N, the obj pos is always the same.
k.value = obj.pos
)
s=s+frameStep
)
)
)
Thanks,
Enivob
I have a max script that does camera cuts. Basicaly you put a bunch of camera in the scene, then run the script and it makes a new camera that cuts between all the others. I want to enhance this so it can cut between animated cameras, this is where I am running into problems.
I am trying to get the position of an object that has its position derived from a path position controller.
I assumed that I could simply "poll" the object at any given frame to get the position of the object on the path at that frame. But this is not working, I always get the same value no matter what frame I move to before I "poll" the object.
Here is some code... perhaps someone can see my obvious mistake.
obj_array = $* as array
s=0
frameCount = animationrange.end
frameStep = frameCount / objCount
--Create the camera and the target for the camera.
camTarget = targetobject position:[0,0,10]
newCamera = targetcamera pos:[0,0,0] target:camTarget name:"CutCam"
newCamera.target.name = newCamera.name + ".Target"
-- Create and assign new controller.
ctrl = bezier_position ()
newCamera.pos.controller = ctrl
trgt = bezier_position ()
newCamera.target.pos.controller = trgt
for obj in obj_array do
(
result = case superclassof obj of
(
Camera:
(
-- Animate the camera.
for n = s to (s + frameStep) do
(
at time n
k = addNewKey ctrl n
-- Here is the problem line, even though I am at frame N, the obj pos is always the same.
k.value = obj.pos
)
s=s+frameStep
)
)
)
Thanks,
Enivob
