General Scripting Information
Inline Ruby Code & Units
Parameters to functions can utilize inline ruby code. This flexibility also extends to units of measure. For instance, measurements can be specified in formats like 34mm or 3″*12′. If no unit is defined, the function will default to using the model’s set unit.
Variables
Certain variables are provided to ease the scripting process:
fps: Represents the frames per second as set in the user dialog.
duration: Defines the total video duration, also set in the dialog.
x, y, z: These are the local axes for movement and orientation.
wx, wy, wz: World axes, useful for global movement and orientation without being affected by the object’s local orientation.
a: Represents all axes.
Assignable Variables
You can also assign certain values to variables, for instance:
Seed = 1234: Set the random seed. Useful when you need random but consistent animations. Set this before using any random generation functions to ensure consistency.
You can set custom variables, such as angle = 45 in the main script, and these variables will be accessible by all scripts. This approach reduces the need for hard-coded numbers and simplifies adjustments. Additionally, you can utilize a wide range of Ruby commands.
Animation Commands
Repeat
Allows you to repeat another animation command multiple times without the need to manually copy and paste. Useful for effects like making an object pulse repeatedly, simulating a “heartbeat” effect.
Hide
Make an object disappear and reappear within the given time range. Hide(start_at, end_at) defines when the object will be hidden (start_at) and when it will reappear (end_at).
Move
Move an object along a specified local axis or world axis using Move(axis, distance, start_at, end_at). Movement begins at start_at and ends at end_at.
Accelerate
This function propels an object along its local axis or world axis, continually increasing its velocity. Unlike the Move command, the object doesn’t halt its velocity at end_at but continues with its attained speed.
TimeDecelerate
Decelerate an object over time with TimeDecelerate(axis, start_at, end_at). The object’s speed decreases gradually from start_at to end_at.
DistDecelerate
Using DistDecelerate(axis, distance, start_at), an object will slow down to a stop over the distance, starting its deceleration at start_at.
Yaw, Pitch, Roll
Rotate an object around its local axes. For example, Yaw(angle, start_at, end_at) induces rotation around the y-axis. Pitch and Roll function similarly for the x and z axes, respectively.
Rotate
Rotate an object around a chosen axis with Rotate(axis, angle, start_at, end_at), starting at start_at and finishing at end_at.
RotateSmooth
Ensures a fluid rotation of an object around an axis with easing in and out effects, minimizing abruptness in rotation commencement and conclusion.
Scale
Resize an object by a multiplier with Scale(a|axis, amount, start_at, end_at). An amount of 2 would double its size, and 0.5 would halve it. Use ‘a’ to scale on all axis.
PulseScale
Achieve a pulsating scaling effect with PulseScale(a|axis, min, max, pps, start_at, end_at). The object oscillates in size between min and max at a rate of pps (pulses per second).
Walk
Simulate a human-like walking camera movement using Walk(speed, distance, start_at). This function captures human walking nuances, including navigating terrains like stairs and hills, providing a natural walking perspective.
MoveCamera
Move the camera along a designated axis via MoveCamera(axis, distance, start_at, end_at).
RotateCamera
Rotate the camera around an axis using RotateCamera(axis, angle, start_at, end_at).
GlueCamera
Attach the camera to a group or component with GlueCamera(start_at, end_at). It’ll appear as though the camera is affixed to that object, following its every movement.
LookAt
Direct the camera’s focus on an object with a smooth easing effect using LookAt(easing, start_at, end_at).
Zoom
Zoom in or out with the camera using Zoom(xTime, start_at, end_at).
Follow
Have the camera tail an object through a time duration with Follow(start_at, end_at).
Orbit
Orbit the camera around a point it’s focusing on (not necessarily an object) with Orbit(start_at, end_at).
FreeFall
Simulate the effects of gravity on an object using FreeFall(gravity, restitution, start_at, end_at). The object will fall and bounce based on the restitution value upon hitting a surface.
Spin
Allows an inner object to spin within an outer object that’s moving in a direction. Example: a soccer ball moving forward while spinning. The outer component dictates movement, while the inner one handles the spin. The parent_axis guides the spin direction.
Swing
Simulate a pendulum-like swing using Swing(x|y axis, length, gravity, damping, start_at, end_at).
Steer
Ideal for steering simulations. The Steer(axis, parent_turn_axis, parent_forward_axis, wheel_base, track) function incorporates parameters like wheel_base (distance between front and rear axles) and track (distance between left and right wheels) to simulate realistic turns, like a car for example.