Re: Animationset
From: Spudeister (gary_at_mr-gamemaker.com)
Date: 10/26/04
- Next message: jamesshennan_at_hotmail.com: "Re: Cube in 3D"
- Previous message: Jack Hoxley: "Re: writing to the backbuffer"
- In reply to: Jack: "Re: Animationset"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 26 Oct 2004 01:25:18 +0100
OK, Well you have to be careful with your naming here.
An animation is a set of keyframes for a given frame in the hierarchy.
Therefore, if you 'Animation Sequences' are merged into a single animation
set, there will be one animation in the X file for every frame that is
animated by either of the sequences. So for example, if you animation set
animated 5 frames in the hierarchy, there will be five animations in the
set.
Now, in your case, because the 'animation' for each frame may contain
keyframe pertaining to both animation sequences, they will be defined
following each other. You need to find the timestamp at which the first
sequence ends and the second one starts. These timestamps are defined in
ticks, so you will need to convert between seconds and ticks to find this
cross over point. You can use the
ID3DXKeyframeAnimationSet::GetSourceTicksPerSecond method to find the ratio
between actual seconds and the tick value used by the timestamps in your
animation. In otherwords, it tells you how many ticks per second are being
processed when your animation is playing.
You can then use this to do one of two things.
1) You can set key events so that when the first sequence ends you rest the
track position back to its starting position so the first animation sequence
will loop. If you do not wish to set a key event for this ( which uses the
controller global timeline ) you could have you application poll for global
time and apply the track position chance once that position is reached. When
you wish to play the second animation sequence, you can once again set the
track position to then start of the second sequence and make that loop round
also when the sequence reaches its end.
1) Failing that, you can do what I usually do. I find the crossover point
where the second sequence starts, and copy all the keyframes into a new
animation set. I then do the same again for the keyframes in the second
sequence. I then release the original animation set and register my two new
ones with the controller. Essentially, I split the combined animation set
into multiple sets so I can set and play each sequence or assign them to
multiple tracks and blend them together.
Whichever you choose, it does rely on you finding out then lengths of each
sequence so you know when one ends and another begins. If you developed the
asset yourself then this will not be a problem. However, if you are using a
3rd party asset, you will have to determine this the hard way.
It might be worth you writing a little tool with a slider bar that allows
you to play the animation frame by frame. As soon as you slide the bar to a
position where one sequence ends, you could have a button that simply rips
all the keyframes out of the current animation set being used to render the
hierarchy and copy it into a new set.
Hope this helps
"Jack" <jl@knight.com> wrote in message
news:eajRYJfuEHA.1184@TK2MSFTNGP10.phx.gbl...
> The source of the problem is associated with this line of code
> m_pAnimController->GetAnimationSet(i, &pSet);
>
> As GetAnimationSet is an API of DirectX, if I don't name each segment
> properly, how do i refer to which animation I am to access?
>
> In addition, Milkshape, probably not good to mention that here, has a
naming
> textbox on the .X Exporter.... I have asked JT that one file can only
store
> one animation. A few days later, I found a skinnedmesh on the web which is
> called zombie.X which only uses one file for animation plus the mesh. I'm
> just wondering how I can do things like this without splitting the mesh
> into 10 files for 10 animations or poses and each has an animation name
that
> I can use in the program..... Thanks
> Jack
>
>
> "Spudeister" <gary@mr-gamemaker.com> wrote in message
> news:#EXg4OHuEHA.200@TK2MSFTNGP11.phx.gbl...
> > What do you mean by segments? Animations in D3DX are defined in
keyframes
> > grouped in 'Animations' inside animation sets, each key frame has a time
> > stamp that is defined in ticks. When you say 1 -20 , what do you mean? 1
> to
> > 20 what?
> >
> > Also, do you have these sequences in a single D3DXKeyframedAnimatonSet
it
> > looks like this is not the case? If so then you will need to determine
the
> > time at which a sequence you wish to play starts and set the track
> position
> > of the track to which the set is assigned to jump to that location when
> you
> > wish to play that sequence.
> >
> > You may have to convert the timestamps of the first keyframes in each
> > sequence ( in ticks ) into seconds initially to determine the correct
> value
> > ( in seconds ) to pass in as the new track position.
> >
> > Can't really be any more help without a more detailed explanation of
your
> > problem
> >
> > "Jacky Luk" <jl@knight.com> wrote in message
> > news:OqYYzL3tEHA.3932@TK2MSFTNGP10.phx.gbl...
> > > I have a track like this
> > > 1->20 walk
> > > 21->30 pump
> > >
> > > This animation segments are fed to direct3d
> > > My question is how do you specify (SetTrackDesc??)
> > > which segments belong to walk and which belong to pump? Thanks
> > > Jack
> > >
> > >
> >
> >
>
>
- Next message: jamesshennan_at_hotmail.com: "Re: Cube in 3D"
- Previous message: Jack Hoxley: "Re: writing to the backbuffer"
- In reply to: Jack: "Re: Animationset"
- Messages sorted by: [ date ] [ thread ]