PDA

View Full Version : User Animated Section of Model - How To Tutorial

[APS]Gnat
Feb 27 2010, 16:21
FYI

[FRL]Myke
Feb 27 2010, 16:39
Excellent.

One thing to note: the duration of the entire animation is calculated as follows

(maxValue - minValue) * animPeriod

So as example this anim config

minValue = 0;
maxValue = 5;
animperiod = 0.5;

will result in a animation duration of 2.5 seconds if the input value changes from 0 to 5.

luckyhendrix
Feb 28 2010, 23:11
Wonderfull gnat ! just what I needed !

[APS]Gnat
Mar 1 2010, 01:37
Thanks for the extra Myke (that was news to me).

@<hidden>

I made it because I've had PM requests on this subject ....... but don't take that to mean you's can PM me for any olde stuff ;) I provide help so ALL can read & learn.

[FRL]Myke
Mar 1 2010, 11:12
I found out about this "formula" when i was animating the numbered wheels to indicate flight level. Although all had animPeriod = 0.001 the Wheels for 1000 and 10'000 where moving much slower. For the 10'000 feet wheel i had maxValue = 100000 (which means a full rotation from 0 to 0). So it was (100000 - 0) * 0.001 = 100 seconds.
So i've experimented and found the above written formula. One should be aware of this as depending on the anim, this can be wanted or unwanted behaviour.
No biggie, just good to know.

Shim13
Mar 1 2010, 18:59
Ive got a problem with mine. I just can't get it to animate. There are some flaps on the back of the model that I want to rotate up as the speed increases. I originally had the source = "speed"; but it didn't work. I rewrote the config to the tutorial to where its a user action, but still nothing. Any one have any ideas?

class CfgSkeletons
{
class Plane{};

class Scout_Bike_Skeleton : Plane
{
isDiscrete = 1;
skeletonInherit = "";
skeletonBones[]=
{
"RThrust","",
"LThrust","",
};
};
};

class CfgModels
{
class Default{};

class Sout_bike: Default
{
skeletonName = "Scout_Bike_Skeleton";
sectionsInherit = "";
sections[] = {};

class Animations
{
class RightThruster{
type = "rotation";
source = "ThrustUp";
selection = "RThrust";
axis = "RThrustPiv";
memory = 1;
minValue = 0;
maxValue = 1;
angle0 = 0;
};
class LeftThruster{
type = "rotation";
source = "ThrustUp";
selection = "LThrust";
axis = "LThrustPiv";
memory = 1;
minValue = 0;
maxValue = 1;
angle0 = 0;
};
};
};
};

class CfgPatches {
class Scout_Bike {
units[] = {"Scout_Bike"};
weapons[] = {};
requiredVersion = 0.1;
};
};

class CfgMovesBasic {
class DefaultDie; // External class reference

class ManActions {
Bike_Driver = "Bike_Driver";
Bike_Cargo = "Bike_Cargo";
};
};

class CfgMovesMaleSdr : CfgMovesBasic {
class States {
file = "\ca\wheeled3\TT650\DATA\anim\KIA_TT650_Driver.rtm";
speed = 1e+010;
terminal = true;
soundEnabled = false;
};

class Crew; // External class reference

class Bike_Driver : Crew {
file = "\shim_sw\DATA\scout_driver.rtm";
};
};
};

class CfgVehicles {
class plane; // External class reference

class Scout_Bike : Plane {
scope = public;
model = "shim_sw\scout_bike.p3d";
icon = "\ca\wheeled3\data\UI\Icon_TT650_M1030_CA.paa";
mapSize = 3;
picture = "\ca\wheeled3\data\UI\Picture_TT650_CA.paa";
displayname = 74z;
vehicleClass = "Car";
side = TWest;
faction = USMC;
crew = "USMC_Soldier";
weapons[] = {};
fuelCapacity = 200;
maxSpeed = 200; // max speed on level road, km/h

// threat (VSoft, VArmor, VAir), how threatening vehicle is to unit types
threat[] = {0, 0, 0};

DriverAction = "Bike_Driver";
getInAction = "GetInLow";
getOutAction = "GetOutLow";
extCameraPosition[] = {0, 1, -5};
armor = 50;
dustEffect = "HeliDust";
waterEffect = "HeliWater";
landingSpeed = 200;
vtol = 0;
aileronSensitivity = 1.0; // relative aileron sensitivity
elevatorSensitivity = 0.7; // relative elevator sensitivity
envelope[] = {0.0, 4.0, 4.5, 5.0, 6.5, 6.5, 6.5, 7.0, 6.4, 5.5, 4.0, 1.8, 0.5, 0};
type = VAir;

class AnimationSources
{
class ThrustUp
{
source = "user";
animPeriod = 5;
initPhase=0;
};
};
class UserActions
{
class OpenRamp
{
displayName="Move up";
position="ACTION_Thrust";
onlyforplayer=0;
condition="(this animationPhase ""AnimateRThrust"" == 0)";
statement="this animate [""AnimateRThrust"",1];";
};
class CloseRamp
{
displayName="Move Down";
position="ACTION_Thrust";
onlyforplayer=0;
condition="(this animationPhase ""AnimateRThrust"" == 1)";
statement="this animate [""AnimateRThrust"",0];";
};
};
};
};

Nothing shows up in the RPT either.

[APS]Gnat
Mar 2 2010, 02:14
eeek .... your code formating was better in the PM than here LOL
Anyhow SOURCE="speed"; should have worked. You should have no need for USER animations.

Per my TIP, your CFGSkeleton and CFGModel should be in a separate file called model.cfg (and remove it from config.cpp)
When thats the case you can then watch the "flap" move in BULDOZER preview by clicking and scrolling the Mouse-Wheel.
If it doesn't move in there;
- Check and make sure that the named section LThrust and LThrust have NO OTHER NAMES for the same bits.
- Remove sourceAddress = "clamp"; (generally only applicable to User animations)
- Change memory = 1; to memory = 0; or try removing altogether.
- Drop the comma at the end of the last bone definition (change "LThrust","", to "LThrust","")

Or it could simply be that under CFGModel you have "class Sout_bike: Default".
As I said, this MUST be exactly the same as the name of you P3D model file name.

Try those, and let me know how you went.
Cheers.

Shim13
Mar 2 2010, 04:13
Thanks Gnat. It works now. I'm betting it was the one small spelling error that you pointed out. I'm going to go back through and see if any of the other things you said to change had an effect. Though if it was just that one error.. I'm gonna go into a corner and cry. But I didn't know the class name had to be the same as the P3D. So I learned something :D

Thanks again.

[APS]Gnat
Mar 2 2010, 05:55
LOL, no problem Shim.

TIPS for all

If you are using sources other than USER, heres a couple of tips.
If we were using "speed" as a source (NOTE: speed is in Meters per Second)

minValue = 0;
maxValue = 27.8;

means the animation will start from zero speed and stop at 100kph

minValue = 11;
maxValue = 16.6;

means the animation will only start moving at 40kph and will completely stop at 60kph

If you are using a source like "gear" (aircraft undercarriage), the values are between 0 and 1
So for the gear-door animation, which must open before the gear decends you'd have a value like
minValue = 0.0;
maxValue = 0.5;

And for the landing gear animation itself you'd have values like this;
minValue = 0.5;
maxValue = 1.0;

luckyhendrix
Mar 2 2010, 21:59
I dunno what I did it used to work then i changed something in my model.cfg and it don't work anymore ( can't view anim in bulldozer, i've a error message in bulldozer : no entry 'bin\config.cpp.cfgSkeletons').

here's my model.cfg

class CfgSkeletons
{
class BMP2_Base;
class lucky_armorBones: BMP2_Base
{
isDiscrete=1;
skeletonInherit = "";
skeletonBones[]=
{
"mlc","",
"frontramp","",
"rearamp",""

};
};
};
class CfgModels
{
class BMP2_Base;
class lucky_armor: BMP2_Base
{
skeletonName="lucky_armorBones";
sectionsInherit="";
sections[]=
{
};

class Animations
{
class mainlcanim
{
type="translation";
source="userAction1";
selection="pravy predni";
begin="lcaxisb";
end="lcaxist";
memory=0;
minValue=0;
maxValue=1;
offset0=0;
offset1=1;
};
class Ramp
{
source="UserRamp";
selection="frontramp";
axis="ramp_axis";
memory=0;
minValue="0.000000";
maxValue="1.500000";
angle0="0.000000";
angle1="-1.9";
animPeriod=1;
};
class Ramp_rear
{
type="Rotation"
source="UserRamp2";
selection="rearramp";
axis="rear_ramp_axis";
memory=0;
minValue="0.000000";
maxValue="1.500000";
angle0="0.000000";
angle1="-1.9";
animPeriod=1;
};
class deflate
{
type="translation";
source="UserDeflate";
selection="bottom";
begin="lcaxisb";
end="lcaxist";
memory=0;
minValue=0;
maxValue=1;
offset0=0;
offset1=1;
};
};
};
};

[APS]Gnat
Mar 3 2010, 01:02
Can't see too much wrong with the code.
You 3d model file name is lucky_armor.p3d right ?
You removed CFGSkeletons and CFGModels from your CONFIG.CPP file right?
The MODEL.CFG is in the same location as the P3D and cpp file?

NOTE: If you make changes to the model.cfg etc, you generally have to load a completely different model and reload the one youre working on, or restart O2 and Buldozer, because O2 & Buldozer don't pick up these changes straight away. Bit of a pain, but its best to be aware because you can be under the FALSE impression that a change you just made didnt work.

luckyhendrix
Mar 3 2010, 13:14
I checked everything is fine , I added type="Rotation" to class Ramp , and now this one is working in bulldozer , but not the 2 others.

[APS]Gnat
Mar 3 2010, 14:01
As these are User animations, you may need a
or similar.

luckyhendrix
Mar 3 2010, 17:38
I added sourceadress = "clamp" but still, only the ramp animation is working.

CSJ
Mar 7 2010, 23:41
typo -
"rearamp","" should be "rearamp","",
another typo -
"rearamp","" should be "rearramp","",

[APS]Gnat
Mar 7 2010, 23:53
Nice catch mate

CSJ
Mar 10 2010, 01:37
I find this a good habit to get into when naming selections
rearramp type as rearRamp or frontramp as frontRamp - less confusion.

[APS]Gnat
Mar 10 2010, 09:44
Yep. and Use a program like Notepad++ that will auto-highlight text that is the same throughout code.

luckyhendrix
Mar 13 2010, 17:56
I managed to get my anim to work , I dunno exctly what I changed but anyway it works. But now i'd like to make a little fan that spin when motor is on like in Mi24 and mi17 but on a tracked vehicle how could I do that ? Wich source should I set ?

CSJ
Mar 15 2010, 11:31
source="rotor";

luckyhendrix
Mar 16 2010, 11:27
no it's not working , maybe it only works for helicopter.

CSJ
Mar 17 2010, 11:49
Set the fan up as if it was the next prop of the plane.
The fan will spin when the engine is on.

luckyhendrix
Mar 17 2010, 17:52
but my model is a ship not a plane ...

granQ
Mar 19 2010, 22:17
use clockminute, but then it will run all the time.. if it inside or a radar makes sense.

i want to know more about type="hide"... too little referense on that one :/

CSJ
Mar 22 2010, 10:43
but my model is a ship not a plane ...
I had a fan on a boat in OFP days, my Airboat had a prop that was animated.
Wire the fan to the engine EH.
BUT - what goes around comes around - when the engine is switched off the fan will spin back to the starting pos.
So you can use two sets of blades, one that turns and one that does not.
Hide either blade, depending on the action being performed, using setobjecttexture.
class fan
{
type="rotation";
source="user";
selection="fan";
axis="axis_fan";
memory=1;
minValue=0.00;
maxValue=1.00;
angle0=0;
angle1= (1500 * 6.283161);
};
Speed of the fan can be set by animPeriod. 500 to 1000 should be suitable.

JDog
Sep 7 2010, 04:22
Is there anything that would affect animation speed changing in multiplayer?

I have:

minValue = 0;
maxValue = 1;
animPeriod = 6;

In SP or as server/host, the animation takes about 3-4 seconds to complete. As a client, it takes like 1 second. Can't seem to see what would make it different. Is animPeriod 'supposed' to be in the config.cpp or the model.cfg? Seems it has a place in both.