Ninja Library - Motion Function

njMotionTranslate

Reflects move motion

FORMAT

void njMotionTranslate( *m, *obj, spline_flag );
NJS_MATRIX *m
NJS_OBJECT *obj
Int spline_flag

PARAMETER

 *m  Pointer to motion structure 
 *obj  Pointer to object structure 
 spline_flag  Spline attribute flag (0: linear and 1:spline) 

RETURN

None

DESCRIPTION

This function reflects the matrix obtained from move motion at each node. To obtain information such as frame motion, this function must call the njSetCurrentMotion() function before use, and, if necessary (if within the hierarchical structure), must call njSetNextMotionNode() function to update the node information after use. (See example.)

EXAMPLE

#include <Shinobi.h>
#define OBJECT  object_sample
#define MOTION  motion_sample
#define LINEAR  0
#define SPLINE  1
extern NJS_MOTION MOTION[];
extern NJS_OBJECT OBJECT[];
Float ff = 0.f;
Int spline_flg = SPLINE;
	:
Sint32 njUserMain(void)
{
 	:
 njSetCurrentMotion(MOTION, ff );
 PushPopMotion( OBJECT );
 ff+=0.2f;
 if( ff >= (MOTION->nbFrame-1) ) ff=0.f;
 	:
}
PushPopMotion(NJS_OBJECT *obj)
{
 njPushMatrix( NULL );
 /* Execute motion function */
 njMotionTranslate( NULL, obj, spline_flg );
 njMotionRotateXYZ( NULL, obj, spline_flg );
 njMotionScale( NULL, obj, spline_flg );
 njSetNextMotionNode();
 /* Draw picture of model */
 if( obj->model != NULL )
  njDrawModel( obj->model );
 
 if( obj->child != NULL )
  PushPopMotion( (NJS_OBJECT*)obj->child );
 
 njPopMatrix( 1 );
 if( obj->sibling != NULL )
  PushPopMotion( (NJS_OBJECT*)obj->sibling );
}
	:

NOTE

This function is used as one of the functions for navigating the parent-child hierarchy (push/pop). These functions (motion of each node) are similar, with exception of the 3D control, to the njAction() and njDrawMotion() groups.

REFERENCE

njSetCurrentMotion()
njMotionTransform()
njMotionTransformZXY()
njMotionRotateXYZ()
njMotionRotateZXY()
njMotionScale()
njGetMotionTranslate()
njGetMotionRotate()
njGetMotionScale()
njSetNextMotionNode()

njMotionTranslate
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999