[Closed] Script for baking animation for constrained objects?
I have been fumbling around trying to find a way to bake out some animation I have on a camera. The camera is animated via three dummies in a hierarchy and I need to ‘bake’ in the animation at every keyframe in worldspace. Currently every method/script I have found bakes the animation in local space so when the dummies/point helpers have been deleted the camera does not retain any of the animation, yet I have a keyframes at every frame. Is there a way to create keyframes that would take the position/rotation of the camera in worldspace at everyframe and allow me to delete everything but the camera and retain all animation?
thanks in advance…
p = point()
for f = animationRange.start to animationRange.end do
(
with animate on
(
slidertime = f
p.transform = camera.transform
)
)
camera.pos.controller = bezier_position()
for f = animationRange.start to animationRange.end do
(
with animate on
(
slidertime = f
camera.transform = p.transform
)
)
delete p
Hi,
to get you cam-animation baked you could download the attached macro-script, install and run it (it is in the category “MTools”). It is based on the “Align over Range”-Script which can be found on scriptspot.com – i modified it in this way that it is a rollout-floater instead of a utility and subframes can be sampled now, too, as well as I implemented undo.
Pick your camera as Source, create a new helper and select it as target, check the desired transformations and hit “Do it”.
Afterwards you should remove all tranformation-keys from your camera (or a copy of it) and link it to the baked helper.
greetings,
Martin
instead of transform you must use offset transform to get proper position if pivot is not on its original place
http://scriptspot.com/3ds-max/camera-io i did this script exactly for the cameras, you can export and after import camera and all will be ok
That shouldnt matter, as im transforming a point to the camera’s current transform offset or not. It would only matter if i was making a new camera with an identity matrix, id have to get the relative space.
Try to move the camera pivot and create e point from Camera.Transform.Position and you will se that it goes to pivot location not to Camera POINT OF VIEW POINT. This is what i ment, its rare case but happens
I dont follow? Do you mean a target camera or a free camera, moving the pivot of the camera in both and creating a point to match the camera’s transform will always result in the world transform of the camera node.transform multipled by its object-offset transform i.e its pivot.
Create some camera and move the camera pivot somewhere away.
After that run those lines of script and you wil see the diference.
I ts very important to have it in mind when you do a camera calculations,
some times pivot is offseted and info is wrong. I personaly know several
people that do animated Orbit by offseting pivot.
—–THIS WILL GO TO PIVOT LOCATION
point pos:$Camera01.transform.position
—–THIS WILL GO TO CAMERA OPTICAL CENTER LOCATION
point pos:$Camera01.objecttransform.position
hellp explains it better:
[left]A node’s transform property contains the Node Transform Matrix, and reflects the position, rotation, and scale of the node’s pivot point. Accessing the pivot property will return the same value as the pos property. Setting the pivot property will move the pivot point location to the specified coordinates, however the node’s geometry will not be moved.
[/left]
[left]A node’s objectoffsetpos, objectoffsetrot, and objectoffsetscale properties contain the component parts of the Object-Offset Transform Matrix. A node’s objecttransform property contains the Object Transform Matrix. Since this matrix is a combination of the Node Transform and Object-Offset Transform Matrices, this property is read only. Note that these properties are always returned in the World coordinate system context.
[/left]
You don’t need the relative tranform offset if your transforming the same object by it’s own space. Only if you make a new object with a different object space that needs to copy the same trasform relative to itself. For this you would you the (newObject * inverse oldObject)*oldObject
Also you can get the object.center for it’s center
My last example explained this I was capturing the objects transform with a point and then transforming the same object minus any controllers using the points transform. I.e I made a reference transform space over time removed any constraints and re-transformed this object using this reference space.