Different camera paths/actions
4 posters
Different camera paths/actions
Hi
I would like to know if possible to make actions for the camera (like in tutorial_15 in the object but in this case applying the movement to the camera).
For example:
Action 1: move forward
Action 2, rotate 360 degrees
, etc.
I have tried to make it in the NLA editor but camera is modified in the timeline.
Option: Is there a way to play the animation from a specific frame? (To put action 1, then action 2, and jump to the desired action frame)?
Thanks
I would like to know if possible to make actions for the camera (like in tutorial_15 in the object but in this case applying the movement to the camera).
For example:
Action 1: move forward
Action 2, rotate 360 degrees
, etc.
I have tried to make it in the NLA editor but camera is modified in the timeline.
Option: Is there a way to play the animation from a specific frame? (To put action 1, then action 2, and jump to the desired action frame)?
Thanks
eloasis- Posts : 16
Join date : 2009-09-10
Re: Different camera paths/actions
you can make multiple IPO's and add them to the camera at any time. I made a few little helper functions to create IPO's on the fly for quick animations and it works pretty good. If you are creating the IPO's on the fly you can start/stop them anywhere you want.
uprise78- Posts : 228
Join date : 2008-10-31
Re: Different camera paths/actions
For that I REALLY recommend you to check the MeditationGarden source... its FULL of that... every objects are dynamically controlled by IPO's (including the Camera).
Cheers,
Cheers,
Re: Different camera paths/actions
Thanks!, now I'm looking for Blender IPO's tutorials to know more about them.
eloasis- Posts : 16
Join date : 2009-09-10
Re: Different camera paths/actions
uprise78 wrote:you can make multiple IPO's and add them to the camera at any time. I made a few little helper functions to create IPO's on the fly for quick animations and it works pretty good. If you are creating the IPO's on the fly you can start/stop them anywhere you want.
Could you share your helper functions to create IPO'S on the fly?
eloasis- Posts : 16
Join date : 2009-09-10
Re: Different camera paths/actions
Here is a snippet you should be able to just drop into tutorial 3 (the one with the cube) and play with. I didn't test this on 1.4 yet and you will probably want to rework these and make some helpers that make sense to you but at least this will get you going with how to make IPO's on the fly.
The basic premise behind the IPO system is that you first create an SIO2ipo. Then you add one or more SIO2ipocurve objects to the SIO2ipo. You can add an SIO2ipocurve for location (x,y,z), rotation (x,y,z) and scale (x,y,z). The examples below have helpers to add the SIO2ipocurves to the SIO2ipo and also helpers to add a bezier part to an SIO2ipocurve.
So, to review, the way you will create IPO's on the fly is the following:
- Create an SIO2ipo object
- Create one or more SIO2ipocurve objects (one for each SIO2transform attribute that you want to modify)
- Add one or more bezier objects to each SIO2ipocurve
- Add the SIO2ipo to the SIO2object
- Bind all IPO's
- Play the IPO (sio2IpoPlay)
Rom, please correct me if I'm wrong about any of this and if someone wants to add this to the wiki that would be superb.
The basic premise behind the IPO system is that you first create an SIO2ipo. Then you add one or more SIO2ipocurve objects to the SIO2ipo. You can add an SIO2ipocurve for location (x,y,z), rotation (x,y,z) and scale (x,y,z). The examples below have helpers to add the SIO2ipocurves to the SIO2ipo and also helpers to add a bezier part to an SIO2ipocurve.
So, to review, the way you will create IPO's on the fly is the following:
- Create an SIO2ipo object
- Create one or more SIO2ipocurve objects (one for each SIO2transform attribute that you want to modify)
- Add one or more bezier objects to each SIO2ipocurve
- Add the SIO2ipo to the SIO2object
- Bind all IPO's
- Play the IPO (sio2IpoPlay)
Rom, please correct me if I'm wrong about any of this and if someone wants to add this to the wiki that would be superb.
- 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;
//_ipoCurve->point[ _ipoCurve->n_point - 1 ].hdl1 = _bez->hdl1;
//_ipoCurve->point[ _ipoCurve->n_point - 1 ].knot.x = _bez->knot.x;
//_ipoCurve->point[ _ipoCurve->n_point - 1 ].knot.y = _bez->knot.y;
//_ipoCurve->point[ _ipoCurve->n_point - 1 ].hdl2 = _bez->hdl2;
}
void sio2IpoCurveAddBezierParts( SIO2ipocurve *_ipoCurve, float hdl1, float interval, float value, float hdl2 )
{
++_ipoCurve->n_point;
_ipoCurve->point = ( bez3 * ) realloc( _ipoCurve->point, _ipoCurve->n_point * sizeof( bez3 ) );
// Shorthand assignment
//_ipoCurve->point[ _ipoCurve->n_point - 1 ] = (bez3){ hdl1, { interval, value }, hdl2 };
// Clearer assignments
_ipoCurve->point[ _ipoCurve->n_point - 1 ].hdl1 = hdl1;
_ipoCurve->point[ _ipoCurve->n_point - 1 ].knot.x = interval;
_ipoCurve->point[ _ipoCurve->n_point - 1 ].knot.y = value;
_ipoCurve->point[ _ipoCurve->n_point - 1 ].hdl2 = hdl2;
}
void moveObjectToYpos( SIO2object *object, float yPos, float duration )
{
// Create an ipo
SIO2ipo *ipo = sio2IpoInit( "myIpo" );
// Create an ipocurve
SIO2ipocurve *yPosCurve = sio2IpoCurveInit();
yPosCurve->interpolation = SIO2_IPO_CURVE_INTERPOLATION_BEZIER;
yPosCurve->extrapolation = SIO2_IPO_CURVE_EXTRAPOLATION_CYCLIC;
// Add our curve points (hdl1, fps, value, hdl2)
sio2IpoCurveAddBezierParts( yPosCurve, 0.0, 0.0, object->_SIO2transform->loc->y, 0.0 );
sio2IpoCurveAddBezierParts( yPosCurve, 0.0, duration, yPos, 0.0 );
// Add our sio2ipocurve to the ipo
ipo->locy = yPosCurve;
// Add the ipo to the object
sio2StringCpy( object->iponame, ipo->name );
// Bind the ipo
sio2ResourceBindAllIpos( sio2->_SIO2resource );
// Start playing the ipo
sio2IpoPlay( object->_SIO2ipo );
}
void moveObjectToXpos( SIO2object *object, float xPos, float duration )
{
// Create an ipo
SIO2ipo *ipo = sio2IpoInit( "myIpo" );
// Create an ipocurve
SIO2ipocurve *xPosCurve = sio2IpoCurveInit();
xPosCurve->interpolation = SIO2_IPO_CURVE_INTERPOLATION_BEZIER;
xPosCurve->extrapolation = SIO2_IPO_CURVE_EXTRAPOLATION_CYCLIC;
// Add our curve points (hdl1, fps, value, hdl2)
sio2IpoCurveAddBezierParts( xPosCurve, 0.0, 0.0, object->_SIO2transform->loc->x, 0.0 );
sio2IpoCurveAddBezierParts( xPosCurve, 0.0, duration, xPos, 0.0 );
// Add our sio2ipocurve to the ipo
ipo->locx = xPosCurve;
// Add the ipo to the object
sio2StringCpy( object->iponame, ipo->name );
// Bind the ipo
sio2ResourceBindAllIpos( sio2->_SIO2resource );
// Start playing the ipo
sio2IpoPlay( object->_SIO2ipo );
}
void templateScreenTap( void *_ptr, unsigned char _state )
{
if( _state == SIO2_WINDOW_TAP_UP )
{
// Grab the cube
SIO2object *cube = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube" );
moveObjectToXpos( cube, 13.0, 1 );
return;
/* Relevant exporter section
buffer = "\t%s( %s %s %s %s )\n" % ( token,
optimize_float( p.vec[0][1] * scale ),
optimize_float( p.vec[1][0] * ( 1.0 / ctx.fps ) ),
optimize_float( p.vec[1][1] * scale ),
optimize_float( p.vec[2][1] * scale ) )
*/
// Create an ipo
SIO2ipo *ipo = sio2IpoInit( "myIpo" );
// Create an ipocurve
SIO2ipocurve *yPosCurve = sio2IpoCurveInit();
yPosCurve->interpolation = SIO2_IPO_CURVE_INTERPOLATION_BEZIER;
//yPosCurve->interpolation = SIO2_IPO_CURVE_INTERPOLATION_LINEAR;
yPosCurve->extrapolation = SIO2_IPO_CURVE_EXTRAPOLATION_CYCLIC;
// Add our curve points (hdl1, interval, value, hdl2)
sio2IpoCurveAddBezierParts( yPosCurve, 0.0, 0.8, 0.0, 0.0 );
//sio2IpoCurveAddBezierParts( yPosCurve, 3.0, 1.6, 5.0, 6.8 );
sio2IpoCurveAddBezierParts( yPosCurve, 0.0, 2.4, 10.0, 0.0 );
//sio2IpoCurveAddBezierParts( yPosCurve, 5.0, 3.2, 5.0, 6.8 );
sio2IpoCurveAddBezierParts( yPosCurve, 0.0, 2.6, 0.0, 0.0 );
// Add our sio2ipocurve to the ipo
ipo->locy = yPosCurve;
// Add the ipo to the object
sio2StringCpy( cube->iponame, ipo->name );
// Bind the ipo
sio2ResourceBindAllIpos( sio2->_SIO2resource );
// Start playing the ipo
sio2IpoPlay( cube->_SIO2ipo );
}
// Toggle fade_out ON/OFF
if( _state == SIO2_WINDOW_TAP_UP )
{
//fade_out = !fade_out;
}
}
uprise78- Posts : 228
Join date : 2008-10-31
Re: Different camera paths/actions
Hi uprise78, thanks for your snippet!
I have tried to to get it working with 1.4 and 1.3.5 but when I tap to execute it the Cube disappears.
Debugging step by step, it disappears on: sio2ResourceBindAllIpos( sio2->_SIO2resource );
Thanks again
I have tried to to get it working with 1.4 and 1.3.5 but when I tap to execute it the Cube disappears.
Debugging step by step, it disappears on: sio2ResourceBindAllIpos( sio2->_SIO2resource );
Thanks again
eloasis- Posts : 16
Join date : 2009-09-10
Re: Different camera paths/actions
Hi, did you add SIO2_RENDER_IPO flag to the sio2ResourceRender() calls?
--yarri
--yarri
yarri- Posts : 81
Join date : 2009-04-10
Similar topics
» Relative Paths
» "Background" actions. - Newbie question
» Using my own camera
» Camera or Object
» Camera Sugestion
» "Background" actions. - Newbie question
» Using my own camera
» Camera or Object
» Camera Sugestion
Permissions in this forum:
You cannot reply to topics in this forum