Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Author Topic: data storage in/during controller scripts  (Read 3000 times)

klavan

  • Newbie
  • *
  • Posts: 1
    • View Profile
data storage in/during controller scripts
« on: October 10, 2008, 09:30:49 pm »

is it possible to calculate the speed of a moving element in a controller script? There is no data storage between scripts so you don't know e.g. the element's position in the previous frame.....

Thanx
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: data storage in/during controller scripts
« Reply #1 on: October 10, 2008, 10:33:30 pm »

You can access an element's position and orientation for each frame from a script.  You can create a dummy element to hold values between frames.  Between these two things, you can calculate rotational and translational velocities and acceleration.

It would be helpful if you could describe what you are trying to do.   There are techniques for reading the position of one element to set the other.  For example, one can use a controller script to control the rotation of tires, another script to move the vehicle proportionally to the rotation of the car, and yet another to move the camera with the car, and so on.
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 1532
    • View Profile
Re: data storage in/during controller scripts
« Reply #2 on: October 12, 2008, 10:00:07 pm »

There aren't any ways to read data in a controller other that values of the current frame.  If one frame depended on another's values it would allow computations that wouldn't evaluate to the same value each time they were executed.  Anim8or can evaluate key values an unexpected times.  This could make your animation behave differently each time and even make single frames move about chaotically.
Logged

hf003

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: data storage in/during controller scripts
« Reply #3 on: April 25, 2010, 10:22:26 pm »

I am a bit confused as to why you say there would be unpredictable outcomes if we used information of previous frames to compute new values in the current frame. It seems to me if the initial conditions and computation are always the same, the outcome would always be the same as well. For instance, if we could set the initial position of an object to 0,0,0, then in a position controller script set the object's X position of the current frame to the position of the previous frame's X position+1. How would the outcome be different each time the scene is played? At frame 10, the objects position should always be 10,0,0. Maybe Steve or someone can elaborate on this example to show what I am missing. It seems it would make animation easier in some cases if information of at least the previous frame's object parameters were known to the current frame's script.
Logged