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 Professional Discussion / Why don't work bsp collision for object? or I am idiot . ???

Author
Message
pavelsv1982
15
Years of Service
User Offline
Joined: 7th Feb 2011
Location:
Posted: 18th Feb 2011 22:33
Why don't work bsp collision for object? or I am idiot. ???

program code:
rem Standard Setup Code
sync on : sync rate 30 : color backdrop rgb(0,0,64) : backdrop on
set text font "arial" : set text size 16
set text to bold : set text transparent

rem Loading prompt
sync : center text screen width()/2,screen height()/2,"LOADING" : sync

rem Set camera
set camera range 0.1,5000
autocam off
rem Load BSP world
load bsp "map1.pk3","map1.bsp"
set bsp camera collision 1,0,1,0
set bsp collision threshhold 1,0.1

position camera 0,-39,30,120
rem Main loop
desc$="BSP in One Command"
load object "model\ppsh 41\PPSH 41.x",10
scale object 10,10,10,10
load object "model\Bezerker\Bezerker.x",20
position object 20,-38,5,-135
scale object 20,10,10,10
SET BSP OBJECT COLLISION 2, 20, 1, 0
set bsp collision threshhold 2,0.1


t=0
PITCH OBJECT UP 20, 90
do

if abs(OBJECT POSITION X(20)-camera position x())<5 and abs(OBJECT POSITION z(20)-camera position z())<5
t=1
endif

if t=1
MOVE OBJECT down 20, 0.5
ROLL OBJECT LEFT 20, 0.1
position object 20,OBJECT POSITION X(20),OBJECT POSITION y(20)-0.05,OBJECT POSITION z(20)
endif

rem position object 20,OBJECT POSITION X(20),OBJECT POSITION y(20)-0.05,OBJECT POSITION z(20)
position object 10,camera position x(),camera position y(),camera position z()
PITCH CAMERA UP 0,90
SET OBJECT TO CAMERA ORIENTATION 10
PITCH CAMERA down 0,90
mOVE OBJECT 10,-1
rem rotate object 10,270,0,0
rem Control camera automatically
rem Control camera over terrain
rem контроль камеры
cr#=0
cf#=0
if rightkey()=1 or KEYSTATE(32)=1 then cr#=-0.5
if leftkey()=1 or KEYSTATE(30)=1 then cr#=0.5
if upkey()=1 or KEYSTATE(17)=1 then cf#=0.5
if downkey()=1 or KEYSTATE(31)=1 then cf#=-0.5
ncr#=curvevalue(cr#,ncr#,5)
ncf#=curvevalue(cf#,ncf#,5)
cx#=cx#+mousemovey()*0.2
cy#=cy#+mousemovex()*0.2
if cx#>80 then cx#=80
if cx#<-80 then cx#=-80
ncx#=curveangle(cx#,ncx#,2)
ncy#=curveangle(cy#,ncy#,2)
move camera ncf#
rotate camera 0,wrapvalue(ncy#-90),0
move camera ncr#
rotate camera 0,wrapvalue(ncy#+90),0
rotate camera ncx#,ncy#,0

rem Apply simple gravity to camera
position camera camera position x(),camera position y()-0.1,camera position z()

print camera position x()," ",camera position z()

rem Show Framerate
text 20,screen height()-40,desc$
fps$="DBPro Fps: "+str$(screen fps())
text screen width()-20-text width(fps$),screen height()-40,fps$

rem Update screen
sync

rem End loop
loop
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 19th Feb 2011 16:22
Please use the [ code ][ /code ] tags when displaying your code. Like this:



Also, people won't be able to test your code unless they can download the BSP file.

Malevolence: The Sword of Ahkranox
The infinite RPG
http://www.msoa-game.com
pavelsv1982
15
Years of Service
User Offline
Joined: 7th Feb 2011
Location:
Posted: 25th Feb 2011 16:49
Ok. thanks. grac.
Wyldhunt
16
Years of Service
User Offline
Joined: 27th Sep 2009
Location: The Dark Side
Posted: 28th Feb 2011 21:50
See if this example code will load your BSP with camera collision.
If it works, then you can add the rest of your code back in to this example code.
<GoogleTranslate>Смотрите, если этот пример кода будет загружать ваши BSP с камеры столкновений.
Если он работает, то Вы можете добавить остальной код обратно в данном примере кода.</GoogleTranslate>

Login to post a reply

Server time is: 2026-07-16 23:19:30
Your offset time is: 2026-07-16 23:19:30