Posted: 26th Sep 2004 22:54
This is just a simple test I'm trying to do. Everything in this code works fine to load a matrix with a camera that is pointed at the object and follows it around the matrix when you press the keys, but the animation doesn't appear, only a small cube that reperesents the center pivot position of where the object anim is supposed to be.
What changes can I make to this code to solve this problem. Also what and where can I put in it to 1: Loop the animation 2: Set the speed of the animation 3: Set the speed the object anim and camera move forwards, backward ect when pressing the arrow keys?
If you want to try this code out so you can see for yourself then simply select all the text with your mouse, right click on the highlighted text then click on copy, go into dark basic editor click on edit then click on paste. You will have to insert a bitmap for the floor and an animation where it says to. Then to show me your edited version of this programming simply copy it out of darkbasic and paste it into your post the same way you copied it in only the other way.
rem ===========================================
rem DARK BASIC EXAMPLE PROGRAM 3
rem ===========================================
rem This program operates a third person camera
rem -------------------------------------------
rem Make a simple scene for the camera to look at
make matrix 1,10000.0,10000.0,25,25
rem insert your bitmap here
load bitmap "-----------",1
get image 1,0,0,256,256
delete bitmap 1
prepare matrix texture 1,1,2,2
randomize matrix 1,50.0
set matrix height 1,12,12,300.0
update matrix 1
rem load object anim in here
load object "-------------.x", 1
rem Set variables for character position
x#=500
z#=500
rem Activate manual sync
sync on
rem Begin loop
do
rem Control camera with arrow keys
if upkey()=1 then x#=newxvalue(x#,a#,10) : z#=newzvalue(z#,a#,10)
if downkey()=1 then x#=newxvalue(x#,a#,-10) : z#=newzvalue(z#,a#,-10)
if leftkey()=1 then a#=wrapvalue(a#-10.0)
if rightkey()=1 then a#=wrapvalue(a#+10.0)
rem Update character
y#=get ground height(1,x#,z#)+50.0
position object 1,x#,y#,z#
yrotate object 1,a#
rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(a#+180),300)
cz#=newzvalue(z#,wrapvalue(a#+180),300)
cy#=get ground height(1,cx#,cz#)+100.0
position camera cx#,cy#,cz#
rem Point camera at object
point camera x#,y#,z#
rem Syncronise
sync
rem End loop
loop
Plz help