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.

DarkBASIC Discussion / prob with camera and movement

Author
Message
sarin
21
Years of Service
User Offline
Joined: 20th Mar 2004
Location: nowhere
Posted: 23rd Jul 2004 09:34
hey, anyone see a solution with this problem? the main problem is that the camera only rotates right for about 180 degrees, then rotates opposite the other 180 degrees. also, my guy only moves diagonally. anyone no how to fix these? w a s d to move, btw.


hide mouse : sync rate 60
Autocam off : sync on
position camera 20,0,0

rem wall and ground textures
load image "multi.bmp",101
load image "multi2.bmp",102

rem ground
make matrix 1,10000.0,10000.0,25,25
prepare matrix texture 1,102,2,2
randomize matrix 1,200
set matrix height 1,12,12,300.0
position matrix 1,0,-20,0
update matrix 1

rem legs
load object "rarm.3ds",27
load object "rarm.3ds",28
load object "larm.3ds",29
load object "larm.3ds",30
scale object 27,15,15,15
scale object 28,15,15,15
scale object 29,15,15,15
scale object 30,15,15,15
make mesh from object 7,27
make mesh from object 8,28
make mesh from object 9,29
make mesh from object 10,30
delete object 27
delete object 28
delete object 29
delete object 30

rem right arm
load object "rarm.3ds",1
load object "rarm.3ds",2
scale object 1,15,15,15
scale object 2,15,15,15
make mesh from object 1,1
make mesh from object 2,2
hide object 1
hide object 2

rem swords
load object "sword1.3ds",11
yrotate object 11,90
scale object 11,20,20,20
make mesh from object 11,11
load object "sword1.3ds",12
yrotate object 12,90
scale object 12,20,20,20
make mesh from object 12,12

rem left arm
load object "larm.3ds",3
load object "larm.3ds",4
scale object 3,15,15,15
scale object 4,15,15,15
make mesh from object 3,3
make mesh from object 4,4
hide object 3
hide object 4

rem texture
load image "arm.bmp",1
load image "torso.bmp",2
load image "sword.bmp",3

rem torso
make object cube 10,10
texture object 10,2

rem right limbs
add limb 10,1,1
texture limb 10,1,1
offset limb 10,1,4,3,3
add limb 10,2,2
texture limb 10,2,1
offset limb 10,2,0,-.5,9
link limb 10,2,1


rem left limbs
add limb 10,3,3
texture limb 10,3,1
offset limb 10,3,-4,3,3
add limb 10,4,4
texture limb 10,4,1
offset limb 10,4,0,-.5,9
link limb 10,4,3


rem sword limbs
add limb 10,5,11
add limb 10,6,12
offset limb 10,5,0,0,9
offset limb 10,6,0,0,9
link limb 10,5,2
link limb 10,6,4
texture limb 10,5,3
texture limb 10,6,3
delete object 11
delete object 12

rem leg limbs
add limb 10,7,7
add limb 10,8,8
add limb 10,9,9
add limb 10,10,10
rotate limb 10,7,90,0,0
rotate limb 10,9,90,0,0
offset limb 10,7,3,-6,0
offset limb 10,8,0,0,-7
offset limb 10,9,-3,-6,0
offset limb 10,10,0,0,-7
link limb 10,8,7
link limb 10,10,9
texture limb 10,7,1
texture limb 10,8,1
texture limb 10,9,1
texture limb 10,10,1

REM
DO
REM


rem VARIABLES
a#=object angle y(10)
ox#=object position x(10) : oy#=object position y(10) : oz#=object position z(10)

gh#=get ground height(1,ox#,oz#)

for p=1 to 4
lpx#=limb position x(10,p)
lpy#=limb position y(10,p)
lpz#=limb position z(10,p)
position object p,lpx#,lpy#,lpz#
next p

asrx#=limb angle x(10,5) : asry#=limb angle y(10,5) : asrz#=limb angle z(10,5)
bsrx#=limb angle x(10,6) : bsry#=limb angle y(10,6) : bsrz#=limb angle z(10,6)
mx#=mousemovex() : my#=mousemovey()


if mx#>30 then mx#=30
if mx#<-30 then mx#=-30
if my#>30 then my#=30
if my#<-30 then my#=-30
rem END OF VARIABLES

rem tab rotate sword
if keystate(15) and asrz#=0 and mouseclick()=2 and achg#>10 then rotate limb 10,5,asrx#,asry#,90
if keystate(15) and bsrz#=0 and mouseclick()=1 and bchg#>10 then rotate limb 10,6,bsrx#,bsry#,270

rem tab rotate back
if keystate(15) and asrz#>0 and mouseclick()=2 and achg#>10 then rotate limb 10,5,asrx#,asry#,0
if keystate(15) and bsrz#>0 and mouseclick()=1 and bchg#>10 then rotate limb 10,6,bsrx#,bsry#,0

rem ctrl and alt arm
if keystate(29) and object angle y(2)=0 and mouseclick()=2 then yrotate object 2,330
if keystate(56) and object angle y(4)=0 and mouseclick()=1 then yrotate object 4,30

rem ctrl and alt back
if keystate(56) and object angle y(2)=330 and mouseclick()=2 then yrotate object 2,0
if keystate(29) and object angle y(4)=30 and mouseclick()=1 then yrotate object 4,0

rem forward and backward
if keystate(17) then move object 10,10
if keystate(31) then move object 10,-10


rem vars again
a#=object angle y(10)
ox#=object position x(10) : oy#=object position y(10) : oz#=object position z(10)


REM ROTATIONS OF LIMBS
if mouseclick()=2 then gosub rightARM
if mouseclick()=1 then gosub leftARM

rorx#=object angle x(1) : rory#=object angle y(1)
lorx#=object angle x(3) : lory#=object angle y(3)
rrory#=object angle y(2) : rrorz#=object angle z(2)
llory#=object angle y(4) : llorz#=object angle z(4)

rotate limb 10,1,rorx#,rory#,0
rotate limb 10,3,lorx#,lory#,0
rotate limb 10,2,0,rrory#,rrorz#
rotate limb 10,4,0,llory#,llorz#

if mx#>3 then mx#=3
if mx#<-3 then mx#=-3
if my#>3 then my#=3
if my#<-3 then my#=-3
if mouseclick()=0 then turn object right 10,mx#
if my#>0 and mouseclick()=0 then pitch object up 10,my#
if my#<0 and mouseclick()=0 then pitch object down 10,0-my#
REM END ROTATIONS OF LIMBS


rem position
oy#=get ground height(1,ox#,oz#)
position object 10,ox#,oy#,ox#

if asrz#=limb angle z(10,5)
else
achg#=0
endif

if bsrz#=limb angle z(10,6)
else
bchg#=0
endif

if achg#<10 then achg#=achg#+.3
if bchg#<10 then bchg#=bchg#+.3


rem camera
cx#=newxvalue(ox#,wrapvalue(a#+180),40)
cz#=newzvalue(oz#,wrapvalue(a#+180),40)
position camera cx#,oy#+10,cz#
point camera ox#,oy#,oz#


rem nothing more
goto main


leftARM:

if mx#>0 then turn object right 3,mx#/4
if mx#<0
mx#=0-mx#
turn object left 3,mx#/4
endif
if my#>0 then pitch object down 3,my#/4
if my#<0
my#=0-my#
pitch object up 3,my#/4
endif
return




rightARM:

if mx#>0 then turn object right 1,mx#/4
if mx#<0
mx#=0-mx#
turn object left 1,mx#/4
endif
if my#>0 then pitch object down 1,my#/4
if my#<0
my#=0-my#
pitch object up 1,my#/4
endif
return




main:

sync

LOOP

Sarin
sarin
21
Years of Service
User Offline
Joined: 20th Mar 2004
Location: nowhere
Posted: 25th Jul 2004 18:24
woops, thought i put it in a snippet. o well, easier to see.
anyways, anyone no how to fix this problem? it was working b4, so i no its prob just an error i made (yes, im mortal) in the movement, but i cant spot it.

bump me, woops, already did to post. HAHAHA














im a phsycopath

Sarin

Login to post a reply

Server time is: 2025-05-24 22:50:39
Your offset time is: 2025-05-24 22:50:39