FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Simple Transform Animation System

3 posters

Go down

Simple Transform Animation System Empty Simple Transform Animation System

Post  uprise78 Fri May 01, 2009 5:43 pm

Before I go ahead and write an animation system I wanted to see if anyone had already made one. I am looking for something that is pretty simple and only deals with sio2Objects that are not in the physics world. Maybe something that could animate location, rotation and scale. Basically, you would just pass it in a final location/rotation/scale and a duration and it would handle the animation for you so you don't need to manually update all your objects in the render function.

Has anyone made something like this yet or shall I get started this weekend?

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  sio2interactive Fri May 01, 2009 5:53 pm

Dude I think you misunderstood what the IPO does... cuz its exactly that...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  uprise78 Fri May 01, 2009 6:02 pm

I though IPO had absolute position and had to be created in advance....What I am looking to do is be able to just tell an object something like: moveTo( x, y, z, timeInterval ) and the animation will occur starting from the current position. Can IPO animate an object based on it's current position?

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  sio2interactive Fri May 01, 2009 6:05 pm

Absolutely... you can easily create an IPO at runtime... Check the exporter to check what exactly is exported...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  uprise78 Fri May 01, 2009 11:16 pm

So, looking through sio2_ipo and sio2_ipoCurve it looks like there isn't a clear way to add ipo's programatically...or maybe im just a bit unclear on this one. Would the process be something like this:

- Grab a handle to the sio2Object
- create an sio2ipo (sio2IpoInit)
- create as many SIO2ipocurve's as needed for any of the transform fields that we want to modify
- add as many bez3's as needed for the animation
- link the sio2ipo to the sio2Object

I have a few questions:

1. From the looks of it, the sio2ipocurve bez3 has 2 handles and a knot. With a GUI I can move the handles around but in code I am not sure what things should be set to. Is there some simple explanation for the 4 values that I am missing?

2. How do you specify the time interval between each of the sio2ipocurves?

3. Would it be possible to see some really simple code just adding an sio2ipo in code that modifies just one property with 2 points? Maybe just move an object from some locX to a different locX?

Thanks,
Mike

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  yarri Sat May 02, 2009 12:45 am

Hi, I'm looking at something similar (adding an IPO curve to an emitter...) and found this thread... haven't done it yet, but I was planning to export a sample IPO curve from Blender and use this code as a starting point to work out the loading:
https://sio2interactive.forumotion.net/about-the-sdk-f1/creating-an-object-in-run-time-t353.htm?highlight=object

--yarri

yarri

Posts : 81
Join date : 2009-04-10

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  uprise78 Sat May 02, 2009 12:30 pm

So, I got a bit further along with getting IPO's working but there are a couple things that I am missing:

1. How do you specify an interval between points in the IPO?

2. What exactly do the handle1/2 and knotx/y control?

I got the following code up and running (using tutorial 3 as a base) but the animation is way too fast/jumpy. On a side note, it seems like it may be a good idea to include a function like the sio2IpoCurveAddBezier below in the SDK for manual creation of IPO's...

Code:

void sio2IpoCurveAddBezier( SIO2ipocurve *_ipoCurve, bez3 *_bez )
{
   ++_ipoCurve->n_point;
   
   _ipoCurve->point = ( bez3 * ) realloc( _ipoCurve->point, _ipoCurve->n_point * sizeof( bez3 ) );
   
   _ipoCurve->point[ _ipoCurve->n_point - 1 ] = *_bez;
}


void templateScreenTap( void *_ptr, unsigned char _state )
{
   if( _state == SIO2_WINDOW_TAP_UP )
   {
      // Grab the cube
      SIO2object *cube = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube" );
      
      char ipoName[ SIO2_MAX_CHAR ] = { "myIpo" };
      
      // Create an ipo
      SIO2ipo *ipo = sio2IpoInit( ipoName );
      
      // Create an ipocurve
      SIO2ipocurve *yPosCurve = sio2IpoCurveInit();
      yPosCurve->interpolation = SIO2_IPO_CURVE_INTERPOLATION_BEZIER;
      yPosCurve->extrapolation = SIO2_IPO_CURVE_EXTRAPOLATION_CYCLIC;
      
      
      // Add our curve points
      bez3 *_bez = ( bez3 * ) calloc( 1, sizeof( bez3 ) );
      _bez->hdl1 = 0.0;
      _bez->knot.x = 0.1;
      _bez->knot.y = 0.0;
      _bez->hdl2 = 0.0;
      sio2IpoCurveAddBezier( yPosCurve, _bez );
      
      
      bez3 *_bez2 = ( bez3 * ) calloc( 1, sizeof( bez3 ) );
      _bez2->hdl1 = 10.0;
      _bez2->knot.x = 0.2;
      _bez2->knot.y = 10.0;
      _bez2->hdl2 = 10.0;
      sio2IpoCurveAddBezier( yPosCurve, _bez2 );
      
      
      bez3 *_bez3 = ( bez3 * ) calloc( 1, sizeof( bez3 ) );
      _bez3->hdl1 = 15.0;
      _bez3->knot.x = 0.1;
      _bez3->knot.y = 15.0;
      _bez3->hdl2 = 15.0;
      sio2IpoCurveAddBezier( yPosCurve, _bez3 );
      
      
      bez3 *_bez4 = ( bez3 * ) calloc( 1, sizeof( bez3 ) );
      _bez4->hdl1 = 25.0;
      _bez4->knot.x = 0.2;
      _bez4->knot.y = 25.0;
      _bez4->hdl2 = 25.0;
      sio2IpoCurveAddBezier( yPosCurve, _bez4 );
      
      
      bez3 *_bez5 = ( bez3 * ) calloc( 1, sizeof( bez3 ) );
      _bez5->hdl1 = 15.0;
      _bez5->knot.x = 0.1;
      _bez5->knot.y = 15.0;
      _bez5->hdl2 = 15.0;
      sio2IpoCurveAddBezier( yPosCurve, _bez5 );
      
      
      bez3 *_bez6 = ( bez3 * ) calloc( 1, sizeof( bez3 ) );
      _bez6->hdl1 = 10.0;
      _bez6->knot.x = 0.2;
      _bez6->knot.y = 10.0;
      _bez6->hdl2 = 10.0;
      sio2IpoCurveAddBezier( yPosCurve, _bez6 );
      
      
      free( _bez );
      free( _bez2 );
      free( _bez3 );
      free( _bez4 );
      free( _bez5 );
      free( _bez6 );
      
      // Add our sio2ipocurve to the ipo
      ipo->locy = yPosCurve;
      
      // Add the ipo to the object
      sio2StringCpy( cube->iponame, ipoName );
      
      // Bind the ipo
      sio2ResourceBindAllIpos( sio2->_SIO2resource );
      
      // Start playing the ipo
      sio2IpoPlay( cube->_SIO2ipo );
   }
}

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  sio2interactive Sat May 02, 2009 4:42 pm

Check the exporter and the IPO editor of blender... you'll understand Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  uprise78 Sat May 02, 2009 11:14 pm

Aha...im getting closer. Thanks for pointing me in the right direction. I see where the fps is coming from and I finally got an animation to work but the details of controlling it are a tiny bit unclear. For the sio2ipocurve exported from Blender I understand the exported knot.x and knot.y. How do handle 1 and handle 2 effect them?

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  sio2interactive Sun May 03, 2009 8:39 am

It's all done in the bezier equation
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Simple Transform Animation System Empty Re: Simple Transform Animation System

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum