Page 1 of 1

Modelef question - different skins, different frames - how?

Posted: Wed Oct 31, 2007 10:47
by Enjay
I've looked through the documentation, but didn't see how to do this:

I have a simple decoration (a security camera) that has 4 frames of animation where the "light" (read a few green pixels) on it is one colour, then another 4 frames of animation where it is a different colour (then it returns to the start). This works fine as a sprite, but I don't know how to get it to work as a model.

I've got the animation working just fine - the camera pans from side to side. However, in order to complete what I want, the camera also needs to be able to change colour on the second pan. How do I do this in modeldef? I think I somehow need to be able to define a second skin to be used by the model during the second set of frames, but I don't know how.

The animation is like this (all using frames CAME*0)

ABCBADED - the first colour

FGHGFIJI - the second colour

Currently my modeldef looks like this:

Model CameraPanning
{
Path "Models"
Model 0 "camera.md2"
Skin 0 "camera.png"
Scale 1.0 1.0 1.0

Frame CAME A 0 "camera1"
Frame CAME B 0 "camera2"
Frame CAME C 0 "camera3"
Frame CAME D 0 "camera4"
Frame CAME E 0 "camera5"
Frame CAME F 0 "camera1"
Frame CAME G 0 "camera2"
Frame CAME H 0 "camera3"
Frame CAME I 0 "camera4"
Frame CAME J 0 "camera5"
}

Thanks for any help.

Posted: Thu Nov 01, 2007 11:49
by Nash
It is cases like this where I wish there was a code pointer to change model skins on the fly.

The best hack I can think of is, first you have to add separate frames for your camera's DECORATE to differentiate the on an doff state. Since your camera is CAME*, add CAMO* (O for "on" :P) states to the DECORATE.

Now for the MODELDEF hackery:

Code: Select all

Model CameraPanning 
{ 
Path "Models" 
Model 0 "camera.md2" 
Skin 0 "camera.png" 
Scale 1.0 1.0 1.0 

Frame CAME A 0 "camera1" 
Frame CAME B 0 "camera2" 
Frame CAME C 0 "camera3" 
Frame CAME D 0 "camera4" 
Frame CAME E 0 "camera5" 
Frame CAME F 0 "camera1" 
Frame CAME G 0 "camera2" 
Frame CAME H 0 "camera3" 
Frame CAME I 0 "camera4" 
Frame CAME J 0 "camera5" 
} 

Model CameraPanning // uses different modelindex
{ 
Path "Models" 
Model 1 "camera.md2" 
Skin 1 "camera2.png" // different texture
Scale 1.0 1.0 1.0 

Frame CAMO A 1 "camera1" 
Frame CAMO B 1 "camera2" 
Frame CAMO C 1 "camera3" 
Frame CAMO D 1 "camera4" 
Frame CAMO E 1 "camera5" 
Frame CAMO F 1 "camera1" 
Frame CAMO G 1 "camera2" 
Frame CAMO H 1 "camera3" 
Frame CAMO I 1 "camera4" 
Frame CAMO J 1 "camera5" 
}
Be sure to put both in the same MODELDEFS.

Posted: Thu Nov 01, 2007 17:02
by Enjay
Exactly the information I needed. Thank you. :)

Posted: Thu Nov 01, 2007 19:10
by Nash
So does it work? To be honest, I made that post right after waking up and a lot of it was recalled vaguely from memory.

Posted: Thu Nov 01, 2007 21:07
by Enjay
Yup, it works just fine. :thumb: