Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: Object Script that Generates Scene Controller Scripts  (Read 19738 times)

NickE

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Object Script that Generates Scene Controller Scripts
« on: July 10, 2008, 04:39:11 pm »

In response to a request from Kreator:

This script outputs to the console two controller scripts - one for position and the other for orientation - generated from reading the position and orientation components of a path.
   
This script requires Anim8or 0.97b or later.
   
The generated controller scripts must be cut and pasted from the console window (debug window) into the "Expression" areas of the controller of the scene element you wish to control.  NOTE:  this is necessary because Anim8or 0.97b broke the file export abilities.  Normally one would export these generated scripts to a text file, but the console is the only output currently available.  It is recommended that the properties of the console window be altered to allow more lines to be buffered.  Do do this:
1) Right-click on the title bar of the "Anim8or Debug Output" window, select "Properties"
2) On the "Layout" tab, increase the "Screen Buffer Size" to some large value (like 1000)
   
The number of frames that it should take to traverse the path must be placed into an integer attribute called "framesperpath" created in the object that contains the path.  If you want the path repeated continuously during the entire length of the the scene, an integer attribute called "repeat" must be created and set to 1 (set to 0 for no repeating).
   
Detailed instructions on usage:
1) Draw the path in a new object that you want followed
2) Go to Object->Attributes...
3) Select "New"
4) Type the name "framesperpath"
5) Select "Int" type
6) Type the number of frames for the path traversal
7) Select "New" again
8) Type the name "repeat"
9) Select "Int" type
10) Type either "1" for repeat or "0" for no repeat
11) Be sure the path is selected
12) Scripts->Run Scripts->path_to_controller.txt

The two scripts will be shown in the console window ready to be cut-and-pasted into the controller expression areas of the element you wish to follow the path.


Please let me know your feedback.
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1146
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: Object Script that Generates Scene Controller Scripts
« Reply #1 on: July 11, 2008, 02:02:22 pm »

Excellent Script NickE !! just what I was looking for!! Scratch my Last PM I could`nt get anything to work on my Laptop at work , which was where I was testing it .... but once I got it home and on a decent sized machine it went like magic!!

Now I`m wondering about Roll as there is provision for that as well but I don`t think that, that is implemented in the current version  ( I might be wrong though!)

Once again THANK YOU very much!

Logged
O

NickE

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Re: Object Script that Generates Scene Controller Scripts
« Reply #2 on: July 11, 2008, 03:41:06 pm »

kreator,
I am not sure what you mean by roll.  Currently the script generates two controller scripts - one for position and the other for orientation.  The orientation is generated by reading the orientation of the spline.  Since the z-direction is along the spline, you effectively only get rotations about the x and y axes from the spline.  I could easily add a provision to generate rotations about the axes if I had a clearer idea of what you have in mind.
Do you want:
1) a static tilt relative to the spline?
2) a continuous rotation as it traverses the spline?
3) all the above, plus other stuff too?

If you can give me a vision of what you are looking for, I will sure attempt it.

Oh, and of course, you are very welcome!  I am glad to contribute to the greater glory of Anim8or!
« Last Edit: July 11, 2008, 03:52:21 pm by NickE »
Logged

RudySchneider

  • Sr. Member
  • ****
  • Posts: 449
  • There are no problems, only opportunities
    • View Profile
Re: Object Script that Generates Scene Controller Scripts
« Reply #3 on: July 11, 2008, 04:06:33 pm »

I don't mean to butt-in here, but I think kreator is referring to Roll as in Roll, Yaw, and Pitch, sometimes also referred to as Roll, Heading, and Bearing, respectively.  In general, this refers to rotations about the Z-, Y-, and X axes, respectively.  For a more long-winded explanation, or for the geeks among us, there's http://en.wikipedia.org/wiki/Flight_dynamics
« Last Edit: July 11, 2008, 04:08:37 pm by RudySchneider »
Logged
G

kreator

  • Hero Member
  • *****
  • Posts: 1146
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: Object Script that Generates Scene Controller Scripts
« Reply #4 on: July 11, 2008, 05:22:49 pm »

No ProbLem Rudy ...... You are quite right.
 I should have explained myself a little better, but you have nailed it on the head ....

Logged
O

NickE

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Re: Object Script that Generates Scene Controller Scripts
« Reply #5 on: July 11, 2008, 05:31:00 pm »

Yes, I guessed that was what kreator meant by roll, but I guess I didn't explain myself very well either.  Do you want to be able to specify a static roll (z-axis rotation) that stays the same throughout the traverse of the path, or do you want to be able to set a continuous rolling "tumble" at some rate relative to the traverse of the path, or both, or something else entirely?

BTW, this is fun, conferring about script functionality.
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1146
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: Object Script that Generates Scene Controller Scripts
« Reply #6 on: July 11, 2008, 06:31:44 pm »

Hi NickE I just did a Test with it (render in OpenGL) I think the animation says it all ...


I also did a quickie with a motorcycle .... I would`nt like to ride that I can tell you!
 ;D

Once the controller script is set then there is no way to alter the Pitch ,Yaw,
and roll That would have to be input manually I think .... (or is there?!)
Logged
O

NickE

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Re: Object Script that Generates Scene Controller Scripts
« Reply #7 on: July 11, 2008, 07:14:13 pm »

Just thinking about it...You could just use the position script and not use the orientation script.  That way you can use the normal animation keyframing methods for controlling orientation.  Unless there is some repetitive rule for the orientation behavior you are wanting, scripting is no better than manual.

Or perhaps, I am still not exactly grasping what it is you are wanting to do.
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1146
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: Object Script that Generates Scene Controller Scripts
« Reply #8 on: July 11, 2008, 07:43:05 pm »

No I think you are right, The orientation can be left out of the equation in these types of object, that require some sort of banking roll pitch etc...then there is some manual control over the object ...... the position part will still implement through the controller. I`ll have another fiddle Later with the Bike and Aircraft!

at least the object can now follow a Path! before it was a case of adding a target and attaching an object to it ..... and the target path was a bit haphazard.

On another subject ..... is it possible to make a script to animate tank tracks ..... I got a plugin (For Carrara that wraps a single link of track around a set of wheels/Sprockets then animates the track going around the wheels ....i don`t know whether it would be possible with visibility? of the track links ? ...or am I just asking too much!
 
« Last Edit: July 11, 2008, 07:49:19 pm by kreator »
Logged
O

NickE

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Re: Object Script that Generates Scene Controller Scripts
« Reply #9 on: July 11, 2008, 08:15:28 pm »

I've actually already been thinking about that problem.  The main difficulty is that you cannot place objects in scene mode with a script.
 
One possibility:  Place each link of the track manually (or ex-program the way Terranim8or does), use a controller script to follow a path for the first link, then use controller expressions to calculate the position of the other links indexed off the first.  A lot of manual setup work or having to write an external program.

Another possibility:  Draw (using the copy_mesh_to_path) several complete tracks each offset such that the traversing of a single link is indexed until it is coincident with the next link.  Then animate using visibility controller scripts like is mentioned above.

Yet another:  write a new script to be run in the morph targets that takes a tread (made with the command version of the copy_mesh_to_path so that each link is a separate shape) and moves each link a bit to generate the several morph targets needed to move a single link distance (width) smoothly.  Then use morphing to create the animation.

There may be others, but I am going to look into the third possibility since it seems the most user friendly.

Your thought would be appreciated.
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1146
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: Object Script that Generates Scene Controller Scripts
« Reply #10 on: July 14, 2008, 06:15:46 am »

WeLL my thoughts are spelt out in another Thread mate
Logged
O