animation interpolation?

Blitz3D Forums/Blitz3D Programming/animation interpolation?

Guy Fawkes(Posted 2010) [#1]
How would I interpolate the speed of an animation of a model? also, how can i make it so that when it reaches a certain speed, it slows the animation down, and reverses the animation such as from a walk to a run?

does anyone have like an example i can see? even if its a car made out of cubes, that does the same thing, so i can see how it works?


Ross C(Posted 2010) [#2]
assuming your using boned animation everything you need is in the animate command. have a look at the manual for that command.


Who was John Galt?(Posted 2010) [#3]
Rez, why not try to learn the basics- like what a list is - before trying to write World Of Warcraft? Even if you manage to create the game you want, it will all have been written by someone else anyway, so what's the point? Where's the sense of achievement?


Ross C(Posted 2010) [#4]
That's why my help comes in the form of concepts and such now. Hopefully Rez can see the commands and visualise how they can be used.


Who was John Galt?(Posted 2010) [#5]
Indeed, Ross. This is how I tried to help him in another thread, unfortunately, some well-intentioned fellow always comes along and posts the complete solution. Net result, Rez has learned nothing in 1 year and hundreds of posts.


Guy Fawkes(Posted 2010) [#6]
how would i basically do the above though? is there any kind of codebase code i can look at that shows an example of this?


Who was John Galt?(Posted 2010) [#7]
how would i basically do the above though?
Translation - "write the code for me"

Ross already told you - look up the animate command in the manual.


Guy Fawkes(Posted 2010) [#8]
translation: NO! STOP BEING A JERK! I ask for a simple code, and of course, as usual, u give me shit! u give EVERYBODY a hard time!


Ross C(Posted 2010) [#9]
I am serious. The animate command, if you look it up, will take an entity, and animate it, and allow you to control the rate of interpolation between keyframes.

http://www.blitzbasic.com/b3ddocs/command.php?name=Animate&ref=3d_a-z


Guy Fawkes(Posted 2010) [#10]
ok, then how do i reverse animation? i tried using the frames backwards before, and it was a disaster


GfK(Posted 2010) [#11]
translation: NO! STOP BEING A JERK! I ask for a simple code, and of course, as usual, u give me shit! u give EVERYBODY a hard time!
k... you REALLY need to stop talking to people like that.

Whether you've got ADD or not, temper tantrums and a potty mouth are not symptoms of it so don't even bother using that as an excuse.

Just knock it off already.


_PJ_(Posted 2010) [#12]
how would i basically do the above though? is there any kind of codebase code i can look at that shows an example of this?


Programming and being a programmer is more than just typing in the code.
The understanding and conceptuality of the commands available and how to use them and how one approaches a challenge are key features too.

Consider this:

Q: How do I report the player score?
A: Print the score as a string onscreen
Q: How do I do that?



There really is no NEED for the second question. Especially not without trying.

The key words are in the answer (in the example: 'Print' 'string' 'screen' and 'score')
Obviously this is much simpler, since
Print Str$(Score)

Is just one lione using basic commands like Print and Str()
But should serve the purpose of highlighting that it's not too difficult to find the means of

a) Printing strings

b) Showing an integer value as a string

In the same way, when someone suggests

assuming your using boned animation everything you need is in the animate command. have a look at the manual for that command.


Then you have the example you are after:

http://www.blitzbasic.com/b3ddocs/command.php?name=AnimTime&ref=3d_a-z


Who was John Galt?(Posted 2010) [#13]
u give EVERYBODY a hard time!
Like who?


Ross C(Posted 2010) [#14]
From the manual page i linked too: (did you read it?)


Description:
Animates an entity.

More info about the optional parameters:

speed# - a negative speed will play the animation backwards




Although, i don't know why you need to reverse the walk animation to achieve what your going for. If you want to switch between running and walk, simply change the animation sequence your using in the animate command. Using a higher transition value will more smoothly translate between them.


Guy Fawkes(Posted 2010) [#15]
i need it for example to play the anim backwards so that way if my player is running, he will eventually come to walk and stop.


JA2(Posted 2010) [#16]
? ? ?


Guy Fawkes(Posted 2010) [#17]
u know, u slowly start walking, then as the speed increases, it turns into a speed walk, followed by a run?


Guy Fawkes(Posted 2010) [#18]
i need that, and the same thing like that only backwards. ur running, and u slow down into a walk then stop


_PJ_(Posted 2010) [#19]
...

Read the line again:

[quote]
speed# - a negative speed will play the animation backwards
[/qoute]

You don't need REVERSE, since the player wont be running backwards.

What you are trying to do, is slow from x down to '0' (Stopped) However, I think you should be prepared for the eventuality that 'Stopped' animation will freeze the model that whatever point in the sequence. Beware of setting speed#=0 when halfway through the anim for example.


Who was John Galt?(Posted 2010) [#20]
I think Rez is trying to run before he can walk.


_PJ_(Posted 2010) [#21]
Rez, you need to think through what you want to achieve.

And explain a bit more clearly in the first instance too, so you dont get code to do one thing onlyy to find later that you need to change the whole approach because you ACTUALLY want to do something that requires a bit more structure behind it.


1= You wanna achieve:
Start animation to speed up to 'run speed'

Stop animation to slow down to 'stop'

2= You will need to ensure

You have some form of time management to ensure the frame speeds are constant

You track the amount of time and frames required between start and end of acceleration (acceleration in both directions)

3= You need to correlate

The current state of the player (i.e. stopped, accelerating, running)
along with
Controller input, Animation frames, time


Start at the bottom and work your way up.