SetAnimKey

Blitz3D Forums/Blitz3D Programming/SetAnimKey

Probaly a very stupid question, but I never really looked into this until now. So just want to know the mechanics of it.

This is a modified setanimkey example
;Create 3d animation example

;Set up a simple nice looking level
Graphics3D 640,480,32,2
camera=CreateCamera()
PositionEntity camera,0,20,-20
RotateEntity camera,35,0,0
light=CreateLight(2)
PositionEntity light,1000,1000,-1000
ground=CreatePlane(2)
EntityAlpha ground,0.5
EntityColor ground,0,0,255
mirror=CreateMirror()

;Lets make a bouncing ball that squashes on impact with the floor.
ball=CreateSphere(16)
EntityShininess ball,1
EntityColor ball,255,0,0


ball2=CreateSphere(2,ball)
EntityShininess ball2,1
MoveEntity ball2,0,2,0

TurnEntity ball2,0,0,20

ball3=CreateSphere(2,ball2)
MoveEntity ball3,0,3,0


; Lets animate him and "record" the 3D animation for later playback
bloat#=0 : flatten#=0 : ypos#=10

For frame=1 To 10
;Drop the ball from height 10 to 2
ypos = ypos - spd#
spd#=spd#+.2
PositionEntity ball,0,ypos,0
ScaleEntity ball,1+bloat,1+flatten,1+bloat
TurnEntity ball2,0,0,30

;Record the frame!
SetAnimKey ball,frame
SetAnimKey ball2,frame
Next

;Now we need to add the frames we've just made to the sequence of "film"!
seq = AddAnimSeq(ball,frame-1) ; total number of frames

;Play it back ping-pong!
Animate ball,2,0.15
While Not KeyHit(1)
UpdateWorld
RenderWorld
Flip
Wend
End


How come when the line "SetAnimKey ball2,frame" is taken out, the rotation animation stops? and if I put that in, it works fine. And If I put setanimkey to ball2, shouldn't I have to addanimseq to ball2 as well?

The structure is :ball is parent to ball2 which is parent to ball3 for those who are wondering.

Thx in advance
Nack

I could be wrong, but I guess this is due to SetAnimkey does not store entity states of children. AddAnimKey at the other hand seems to store things recursively with children settings.

oh thanks. That acuatlly made a lot of sense. Also wanted to add that if i add AddAnimSeq to ball2......it makes no differnece, as it is ignored. weirdd. now can start on new proj. llol