Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Switching Animations

Author
Message
Sickly
15
Years of Service
User Offline
Joined: 14th Jul 2009
Location: Does it matter?
Posted: 12th Jan 2010 06:05
I have been playing with various animation commands, and have yet to figure out how to switch from one animation, to another, and go back to the first. example would be standing idle animation, then moving animation when said key is pressed. when that key is released, going back to the idle animation. I am using the Mutant Alien from TGC store which also came in my dark studio (Dark Matter). I am using the one from tgc store though, because according to what I have read, this method is easier for loading animations. here is the code I have for this animation test that I failed at terribly.



The darkest minds, are often the brightest.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Jan 2010 10:42
Have you checked the total object frames in orther to know how many frames the object has?
TOTAL OBJECT FRAMES(1)

Depending on the 3D program you export to .x, the quantity of frames change...for example..an object made in 3DMax with just 100 frames and eported to .x, will have 16000 frames....160 frames for every one frame we had in Max.
This force you to set object speed with high values, and for example if we knew that our object walk from frame 0 to 20,multiply 20 times by 160 and you will have 3200...so we have to animate our soldat walking with "LOOP OBJECT SOLDAT 0,3200 ", and adjust the object speed.

cheers.

learning every day
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Jan 2010 18:30
You need to know what the character animation frames do. For example, idle may be at frames 22 to 46 and walking might be at 47 to 63. If you don't know what they are, slow down the object's speed to say, 10 or so, play the object and display the current frame on-screen and then write down what it is doing during the particular frames.

Once you know which animation frames do what, you can simply tell the code which one you want to play. For example:

will have object 1 play the walking animation. If no user input is received for a certain length of time, you play the idle animation:

You could also play a different animation if a particular key is pressed.


I do not know if you are familiar with TYPE variables, but it is real easy to assign animation frames using them.

Click my sig to download TGC Heroes v0.88.

Sickly
15
Years of Service
User Offline
Joined: 14th Jul 2009
Location: Does it matter?
Posted: 14th Jan 2010 00:26 Edited at: 14th Jan 2010 04:28
I didnt even try the greater than less thans. I feel silly. Thanks man, back to work I go.

Awsome. I modified the code above a tad, but I have the effect I was looking for and think I understand this concept now to further these types of programming.

The darkest minds, are often the brightest.

Login to post a reply

Server time is: 2024-11-24 20:43:31
Your offset time is: 2024-11-24 20:43:31