|
|
Play Target Clip/Track
About Truespace Archives
These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.
They are retained here for archive purposes only.
Play Target Clip/Track // Roundtable
Post by robert // Dec 16, 2008, 1:50pm
|
robert
Total Posts: 609
|
I remember we got it so that we could play a selected track/clip without having the others play. I just can't remember how we did it.
What I mean is that a trigger object will play a clip instead of starting a sequence that would achieve the same result. So instead of incrementally increasing the degrees of the door's rotation, just play this prerecorded clip.
I've been looking for the forum where we had this, but I can't find this.
Help Please
-Robert |
Post by frootee // Dec 16, 2008, 2:41pm
|
frootee
Total Posts: 2667
|
Here you go Robert.
In the scene I tested I had 2 cylinders, both animated.
This script disables the clip of one cylinder,
then plays the animation.
Only one cylinder's clip will play, since the other's clip
is disabled.
If you have several animated objects in a scene, but only want one or two to play their clips, you would
need to loop through the objects in the scene, and disable the clips of the other objects.
// Execute
// Called to execute the command
function Execute(params)
{
owner = System.ThisOwner();
target = owner + '/Cylinder';
targetAnim = target + '/AnimClip';
RsAnimClip.DisableClip(target, 'AnimClip', true);
RsTime.Play(targetAnim);
} |
Post by robert // Dec 16, 2008, 2:54pm
|
robert
Total Posts: 609
|
Yeah, I remember that. What about simply having a clip and being able to play it at a random time in response to an event?
As that handles it two different clips will be played at the same time if both are made active. I was wondering if you could selectively play one and then at any point play another.
I know it would probably be best to just order the clips, but I'm still curious.
e.g. clip1 for object1 goes from frames 0 to 30, and clip2 for object2 goes from frames 0 to 60. Suppose I wanted to get clip1 to start 23 frames in to clip2 without simply reordering.
You may be wondering what's the point. Well separate events can't trigger separate animations if they all can only play in the manner they appear on the story editor. Mainly it has more of a game application.
I'm pretty sure I can do it with a macro of sorts, just wondered if I could use the standard animation stuff. |
Post by frootee // Dec 16, 2008, 3:08pm
|
frootee
Total Posts: 2667
|
if the above code were in a script command, called something like:
TriggerA_JSC
then when you step on the trigger that will run that command, in the trigger editor, you would type:
Activity.Run(TriggerA_JSC);
then if you have another trigger, you could play a different animation.
But as it stands, you still need to ensure that the other clips are disabled.
One way to guarantee that would be, on scene initialization, disable all the clips, en masse.
Then, in the trigger script, when the player enters the trigger radius,
you would activate that one clip, then play it.
Then, you would deactivate the clip when the player steps outside the trigger radius.
As far as playing clips at random times, your code would have to pass the 'start frame' to
the script which decides when to activate the clip to be played. At that point, the clip is activated.
Since animation is already running, that clip should begin playing automatically. |
Post by robert // Dec 16, 2008, 3:14pm
|
robert
Total Posts: 609
|
Yeah, but with that I can't have one clip playing and randomly start and stop others.
Like have a background animation going then start and stop others via triggers. If all clips are organized to start at frame 0 then they will start there with the background and wait to repeat until the background one finished going the loop, or could I maybe shift the clip around to appropriate times? Could that work? |
Post by frootee // Dec 16, 2008, 3:25pm
|
frootee
Total Posts: 2667
|
Here you go Robert. I think this is what you need.
You can set start and stop frames for clips in script as follows:
myVal1 and myVal2 are variables.
Node.Value( myNode/AnimClip, 'ClipStart' ) = myVal1;
Node.Value( myNode/AnimClip, 'ClipEnd' ) = myVal2;
If you look at the AnimClip for an object, you will see the ClipStart and ClipEnd,
ClipWeight, etc. are connectors which can be edited via script.
Node.Value() is the tool of choice for this. :D
HTH
Froo |
Post by robert // Dec 16, 2008, 3:45pm
|
robert
Total Posts: 609
|
Alright cool, I figured I'd have to do it that way, just wanted to see if there was something easier I was missing.
I sure do like the tS7 SDK documentation though, has everything in it!
Thanks a bunch Froo!:banana::banana: (hehe Fruit for Froot) :D
-Robert |
Post by frootee // Dec 16, 2008, 7:24pm
|
frootee
Total Posts: 2667
|
hehe mmm Poe Tass ee Um!
you're welcome Robert.
The hardest part of the SDK is figuring out where to look. |
|