Necro time! New features: - render radius - rootbone
LOOP - Loop the animation. Default - play once.
"model" - arbitrary .glm file to load
"modelscale" - "x" uniform scale
"modelscale_vec" - "x y z" scale model in each axis
"renderRadius" - default "120" model render radius
"rootbone" - default "model_root" animation root bone
"startframe" - default "0". animation start frame
"endframe" - default "0". animation end frame
"skin" default "models/players/kyle/model_default.skin" - skin file to load. must include path.
- The frames between the "startframe" & "endframe" will play.
- Use "renderRadius" for models larger than a player if you notice them disappearing when moving the camera.
- Use "rootbone" if wanting to change the root bone that the animation will play from.
Now whenever I have 3x Kyles animating in a very small basic test map, my FPS dips from 60 to 49 unless I look away. Something I've missed or done wrong perhaps...... @@Xycaleth @@ensiform @@eezstreet Would I need to precache it?
void SP_misc_model_ghoul( gentity_t *ent )
{
#if 1
ent->s.modelindex = G_ModelIndex( ent->model );
gi.G2API_InitGhoul2Model(ent->ghoul2, ent->model, ent->s.modelindex, NULL_HANDLE, NULL_HANDLE, 0, 0);
//DT EDIT: misc_model_ghoul edits - START
//ent->s.radius = 50;
if (ent->playerModel >= 0)
{
ent->rootBone = gi.G2API_GetBoneIndex(&ent->ghoul2[ent->playerModel], "model_root", qtrue);
}
G_SpawnInt("renderRadius", "120", &ent->s.radius);
//DT EDIT: misc_model_ghoul edits - END
G_SetOrigin( ent, ent->s.origin );
G_SetAngles( ent, ent->s.angles );
qboolean bHasScale = G_SpawnVector( "modelscale_vec", "1 1 1", ent->s.modelScale );
if ( !bHasScale ) {
float temp;
G_SpawnFloat( "modelscale", "0", &temp );
if ( temp != 0.0f ) {
ent->s.modelScale[0] = ent->s.modelScale[1] = ent->s.modelScale[2] = temp;
bHasScale = qtrue;
}
}
if ( bHasScale ) {
//scale the x axis of the bbox up.
ent->maxs[0] *= ent->s.modelScale[0];
ent->mins[0] *= ent->s.modelScale[0];
//scale the y axis of the bbox up.
ent->maxs[1] *= ent->s.modelScale[1];
ent->mins[1] *= ent->s.modelScale[1];
//scale the z axis of the bbox up and adjust origin accordingly
ent->maxs[2] *= ent->s.modelScale[2];
float oldMins2 = ent->mins[2];
ent->mins[2] *= ent->s.modelScale[2];
ent->s.origin[2] += (oldMins2 - ent->mins[2]);
}
//DT EDIT: misc_model_ghoul edits - START
G_SpawnInt("startframe", "0", &ent->startFrame);
G_SpawnInt("endframe", "0", &ent->endFrame);
char *root_boneName;//[MAX_QPATH];
G_SpawnString("rootbone", "model_root", &root_boneName);
gi.G2API_SetBoneAnim(&ent->ghoul2[0], root_boneName, ent->startFrame, ent->endFrame, BONE_ANIM_OVERRIDE_LOOP, 1.0f + Q_flrand(-1.0f, 1.0f) * 0.1f, 0, -1, -1);
ent->endFrame = 0; // don't allow it to do anything with the animation function in G_main
char *skinName;//[MAX_QPATH];
int skin = gi.RE_RegisterSkin(skinName);
G_SpawnString("skin", "models/players/kyle/model_default.skin", &skinName);
gi.G2API_SetSkin(&ent->ghoul2[ent->playerModel], G_SkinIndex(skinName), skin);
//DT EDIT: misc_model_ghoul edits - END
gi.linkentity (ent);
#else