Keyframing procedural camera views

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.

Keyframing procedural camera views // Tech Forum

1  |  

Post by J90 // Sep 17, 2008, 5:35pm

J90
Total Posts: 107
Is it possible to keyframe camera selection/set active camera

Without using the "d3d view package/set active camera" command



If it is not possible Could somebody covert this Jscript Command Script to A VB command Script? Unless Vb can't do this either.


// Execute

// Called to execute the command

function Execute(params)

{

KeyIt = params.ConValue('KeyframeIt');

N = params.ConValue("CamN")

Node.Select(Space.CurrentScene() + "/Camera, " + N);

ScriptObject.RunCmd("d3d view package/set active camera command", N, "", "View", "{00FB4B51-4BBF-4C20-AABB-09A6F7779899}")

if(KeyIt)

{

RsAnim.SetKeyFrame("",N)

}

}

I get an error if I use this script

Error:

Description: Variable uses an Automation type not supported in JScript

Script text: ScriptObject.RunCmd("d3d view package/set active camera command", N, "",



Perhaps I could use the "Set Camera" Node

But I don't know what each of the values do. What value is used to select a camera?

Attached is a picture of the Node.

Thanks

Post by trueBlue // Sep 17, 2008, 8:37pm

trueBlue
Total Posts: 1761
pic
Here is an example. It includes an AnimClip that activates a Timer that activates the script that activates the View from Camera and at the end of the clip deactivates the Timer. Also there is a button script that shows you how to view from this camera.

Post by J90 // Sep 18, 2008, 7:35am

J90
Total Posts: 107
Here is an example. It includes an AnimClip that activates a Timer that activates the script that activates the View from Camera and at the end of the clip deactivates the Timer. Also there is a button script that shows you how to view from this camera.

Thanks Trueblue!
That is exactly what I was looking for.:)
After feyframing it how would I make it so I can see it when I scrub through the animation clips or render it?
How or where did you learn everything. I want to know.
I think you should make a guide to scripting and using the LE. You definitely would help get everybody familiar with it.:jumpy:

Please share your knowledge.:D

Post by Norm // Sep 18, 2008, 7:44am

Norm
Total Posts: 862
pic
The RsAnim.SetKeyFrame() method is looking for two inputs; name of animated encapsulator node and also a value for time, which is the frame value in which keyframes are set.

RsAnim.SetKeyFrame(target, 90)

This would set a keyframe for the variable target (you define) and keyframe is set at frame 90.

Post by trueBlue // Sep 18, 2008, 9:25am

trueBlue
Total Posts: 1761
pic
You are welcome.
Not sure I understand your question. What is it you want to see?
I am just a Hacker. I explain by examples and this is how I have taught myself by looking at examples.

Post by J90 // Sep 18, 2008, 5:33pm

J90
Total Posts: 107
You are welcome.
Not sure I understand your question. What is it you want to see?
I am just a Hacker. I explain by examples and this is how I have taught myself by looking at examples.

Trueblue, if you learn with examples then where are the examples you learn by?

Norm, That isn't what I was looking for.
@Trueblue:
After I set Each camera view with a keyframe Using my script.
I can't render the camera view changes or see them in the 3d view while scrubbing through the keyed objects in the Animation editor

// Execute
// Called to execute the command
function Execute(params)
{
KeyIt = params.ConValue('KeyframeIt');
N = params.ConValue("CamN")
Node.Select(Space.CurrentScene() + "/Camera, " + N);
D3DView.SetActiveCamera('', '%WIN_ID%')
if(KeyIt)
{
RsAnim.SetKeyFrame("", N)
}
}


Attached is a video showing what is happening.

Post by trueBlue // Sep 18, 2008, 9:20pm

trueBlue
Total Posts: 1761
pic
I am not understanding your script. Like Norm has point out, your missing the Keyframe # in your command. Another item is your Cameras have to be included into the Keying panel. They should be highlighted Red as active. I think it would be Much easier if you use only one Camera that is hooked up to a Circle Generator located in the Objects - Tutorial Objects library with a Timer running it. What I did is first put a Camera at X = 0 and Y = 0. Expand it's Matrix and hook up the tx and ty attributes to the Cirlce Generator. Then adjust the radius. I then brought in a Dummy cube and put at World center, selected the Camera, Look At tool, and selected the Dummy cube. You could make invisible if needed. This is for adjusting the height that the Camera looks at. Hook up a Timer's Time to the Angle and Badda Boom Action packed film adventure.
There are tons of example scripts in the trueSpace libraries within Objects, Scenes, and Activities. The Garage in this forum is a gold mine of other examples.

Post by J90 // Sep 19, 2008, 5:43am

J90
Total Posts: 107
Yes it would be easier. I just am trying something Complicated to maybe learn some things.
The script is a bit messed up. I realized that there is the :
RsAnim.SetKeyFrame(Space.CurrentScene() + "/Camera, " + N,N)
that isn't supposed to be there. After adding that to the script to so if it would work I forgot to delete it.
The script that was executed while recording the video doesn't have the red part in it.

I am sorry for confusing you. I can't explain it any better.:(

Thanks again

Post by trueBlue // Sep 19, 2008, 6:10am

trueBlue
Total Posts: 1761
pic
No problem that is the way to learn. The jScript macro recorder is very helpful. Two ways you can record actions.
1.) With an Object selected.
2.) With nothing selected.

Try recording something simple to see what is happening both ways. Some things do not get recorded for instance SetKeyframe.
Here is a script I recorded with the jScript recorder, I then added the command that Norm shows with the addition of the target = Node.Selection()

function Execute(params)
{
target = Node.Selection()
Node.Select(Space.CurrentScene() + "/Camera")
ScriptObject.RunCmd("d3d view package/set active camera command", "Camera", "", "View", "")
RsAnim.SetKeyFrame(target, 10)
Node.Select(Space.CurrentScene() + "/Camera, 1")
ScriptObject.RunCmd("d3d view package/set active camera command", "Camera", "", "View", "")
RsAnim.SetKeyFrame(target, 20)
}

The problem I see is you having to Keyframe a Timer's Active attribute in the AE to get a scipt to run, right?
You do not want the Animation constantly setting the same keyframe, right?
So the above script is not what is needed but only to show an example using the jScript Macro Recorder.
There needs to be a switch statement involved and create Tracks for each Camera, I think.
Would be nice if the Run Activity object could be Keyframed. It is missing an Activate attribute.
Another issue is the only way I can get the Timer Event to show in the AE is to 3D Encapsulate it with an Object.
Still learning myself and hopefuly other users can chime in here to offer a better solutuion.

Post by J90 // Sep 19, 2008, 3:53pm

J90
Total Posts: 107
I might be able to make it easier to understand if I list what I am looking for. Any numbers in red are what i can't get to work.


1. The camera(s) are selected in the order of which they are addded in the scene starting with the first camera being named Camera, 1 then Camera, 2 ect. ect.


2. After the camera node is selected it changes the camera view to the camera selected. Example: Camera, 1 is selected. next it changes the view in the 3d window to Camera, 1. After Camera, 2 is selected it changes the view to Camera, 2. Ect. Ect.


3.The Camera view is then keyframed at the current Camera number for each camera object.

Example:

Camera, 1 is selected, the script sets a keyframe at Frame 1.

Camera, 2 is selected, the script sets a keyframe at Frame 2.

Camera, 3 is selected, the script sets a keyframe at Frame 3.

Ect. Ect.



4. Camera view changes are seen in the 3d view window while scrubbing through the animation clips. Or while rendering


After all keyframes are set I scrub through the animation. I see that the camera view changes are not getting keyed. There must be a keying attribute I am not setting. Each object has its animation clip.

Which keying attribute must be set?

I turned on all the keying attributes that are under/related to the camera object. Still nothing.


I am thinking that I it is not possible yet. I could be wrong though.


Thanks again.

Post by trueBlue // Sep 19, 2008, 9:01pm

trueBlue
Total Posts: 1761
pic
I am not seeing how to Keyframe camera view changes either. I think the best way is to use a Timer instead of the Animation Editor. Once you get the script right switching to each Camera it would be a matter of setting the speed/period of the Timer to get the timing the way you want. You could then Keyframe the Start and Stop of the Timer as well as the speed/period if wanted. The key here btw not sure if you noticed the Window must be selected while you script is running else the command does not work. Here is another example scripting the Disconnect/Connect to different Scripts from the Timer. Again you must have the window selected when running this Timer. Go inside this object while it is running to see the Disconnect/Connecting.

Post by J90 // Sep 19, 2008, 9:39pm

J90
Total Posts: 107
That is going to be useful for many ideas to come.

Thanks for another great example.

I guess this was just another learning experience.:D


maybe it is still possible to render the camera view change. that is really what I wanted.


Thanks though.:)

Post by trueBlue // Sep 19, 2008, 9:46pm

trueBlue
Total Posts: 1761
pic
Here is another example where I Keyframe four different Timers/Cameras Off first Track then On new Track.

Post by J90 // Sep 20, 2008, 8:17am

J90
Total Posts: 107
Here is another example where I Keyframe four different Timers/Cameras Off first Track then On new Track.


I don't see how you set a keyframe.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn