Jump to content
Sign in to follow this  
Crowe

Need Help: Animation => Translation

Recommended Posts

Hi all!

i am trying to build a sliding door for a bunker.

In the model i have defined in LOD 0:

autocenter = 0

In the Memory Lod I have set up:

Door_axis => 2 Points along the axis

Dooropen => 1 point near the entrance

start => 1 point where the animation should start

start2 => 1 point where the animation should end

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgSkeletons

{

scope = public;

class Default

{

isDiscrete = 1;

skeletonInherit = "";

skeletonBones[] = {};

};

class schleuse

{

isDiscrete=1;

skeletonInherit="";

skeletonBones[]=

{

"Door",

""

};

};

};

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgModels

{

class schleuse

{

sectionsInherit = "";

sections[]=

{

"Door"

};

skeletonName="schleuse";

class Animations

{

class Door1

{

type="translation";

source="user";

animPeriod=1;

memory=1;

selection="Door";

axis="Door_axis";

offset0=-10; // Starting offset of this animation, where the animation phase is 0.

offset1=10; // Ending offset of this animation, where the animation phase is 1.

minValue = -10;

maxValue = 10;

minPhase = -10;

maxPhase = 10;

//sourceAddress Does the animation loop or not? This can be any of three different values: clamp (default), loop or mirror. Any

//axisPos[] Position of axis in model space Direct

//axisDir[] Direction of axis (vector) Direct

//axisOffset Used for translation Direct

};

};

};

};

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class cfgVehicles

{

class schleuse : decke

{

displayName = "schleuse";

vehicleClass = "lego";

model="\crowe_lego\schleuse";

animated = true;

destrType=DestructTent;

armor=20;

class AnimationSources

{

class Door1 {animPeriod = 12;};

};

class UserActions

{

class OpenDoors

{

displayNameDefault = $STR_DN_OUT_O_DOOR_DEFAULT;

displayName = $STR_DN_OUT_O_DOOR;

position = Dooropen;

radius = 10;

onlyForPlayer = true;

condition = "this animationPhase ""Door1"" < 0.5";

statement = "this animate [""Door1"", 1]";

};

class CloseDoors

{

displayNameDefault = $STR_DN_OUT_C_DOOR_DEFAULT;

displayName = $STR_DN_OUT_C_DOOR;

position = Dooropen;

radius = 10;

onlyForPlayer = true;

condition = "this animationPhase ""Door1"" >= 0.5";

statement = "this animate [""Door1"", 0]";

};

};

actionBegin1 = OpenDoors;

actionEnd1 = OpenDoors;

};

};

This causes the door to move about 100 metres away, but along the axis.

I want the door to move only 5 meters.

Please help.

Thanks in advace.

Yours

Crowe

Share this post


Link to post
Share on other sites

translations work best with a start and end point defined, not a rotation axis. An example from a recoil anims

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class main_recoil

{

type="translation";

source="50_recoil";

selection="main_recoil";

begin="recoil_start";

end="recoil_end";

initPhase=0;

memory=1;

animPeriod =.5;

sourceAddress="loop";

minValue=0;

maxValue=1;

offset0=0;

offset1=1;

};

if you place the start and end points 5m apart in the model, the door will move 5m. Obviously you need to change things to suit your addon.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×