I did it... sort of.
Look at this. I used the code resources in B3D to learn how to create an animation. Then I rotated and moved the entity and created 10 frames for it to go through.
; how to animate and rotate during that animate
Graphics3D 800,600,0,2 ; set screen size
SetBuffer BackBuffer()
SeedRnd(MilliSecs()) + Pi
AppTitle "YUTZ - Dice game for the rest of us!","Do you want to exit YUTZ?"
camera=CreateCamera() ; create something to see with
PositionEntity camera,6,6,0
RotateEntity camera,40,55,0
light=CreateLight() ; I will dispense with the biblical reference
RotateEntity light,45,0,0 ; move the light a bit to create shadows on the model
AmbientLight 44,44,41
; Load table
table=LoadMesh("board1.x")
UpdateNormals table
EntityFX table,0
RotateEntity table,0,0,0
EntityType table,2
PositionEntity table,-3,-.9,5.25
ScaleEntity table,.015,.015,.015
; Load mesh
die2=LoadMesh("sixdie.x")
UpdateNormals die2
EntityPickMode die2,3
EntityType die2,1
EntityFX die2,0
Collisions 1,2,2,2 ; it has to interact with the board
; too bad I can't figure out a bounce without a lot more code
; Lets animate the dice and "record" the 3D animation for later playback
ypos#=10
xpos#=10
rx#=0
ry#=0
rz#=0
For frame=1 To 10
;Drop the ball from height 10 to 2
ypos = ypos - spd#
xpos=xpos-spd#
spd#=spd#+.27
rx=rx+22
ry=ry+25
rz=rz+99
RotateEntity die2,rx,ry,rz
PositionEntity die2,xpos,ypos,2
rx=rx+1
ry=ry+1
rz=rz+1
RotateEntity die2,rx,ry,rz
SetAnimKey die2,frame
Next
;Now we need to add the frames we've just made to the sequence of "film"!
seq = AddAnimSeq(die2,frame-1) ; total number of frames
;Play it back ping-pong!
Animate die2,3,0.15 ; mode 3 is one time
While Not KeyHit(1)
UpdateWorld
RenderWorld
Flip
Wend
End
--> NOTE <--- hitting {shift} + {esc} clears the topic post box... Hit that instead of !
ANYWAY...
To get the thing to do a gentle curve I think I only have to move it 2 forward and 1 down. A steep curve would be 1 forward and 2 down.
I modified the code from the set of ANIMATE commands in B3D. and modifyed the entity to tumble as it moved... Now to try all 4.
: )
Still making them land and show the right face may take the idea of Malice to do... More thinking needed.
--- Rook