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 / Trying to add camera collision and load textures.

Author
Message
thelighgod
8
Years of Service
User Offline
Joined: 10th Oct 2015
Location:
Posted: 1st Jun 2016 17:49 Edited at: 1st Jun 2016 17:50
Hi guys

I am trying to coad an engine that will run all of my games and I need camera collision. All the textures are not loaded but I need to have them both for my game. Please help me.

HIDE MOUSE
PRINT "NEXT ENGINE VERSION 0.01"
WAIT 500
PRINT "LOADING GAME..."
//Loading the map
SET DIR "Files"
LOAD STATIC OBJECTS "Maps\Map01\Universe.dbo",0
//Setting up the camera
POSITION CAMERA 50,55,-50
make object sphere 1,10
make object cube 2,30
position object 2,object position x(1),object position y(1),object position z(1)+100
do
if upkey()=1 then move object 1,0.25
if downkey()=1 then move object 1,-0.25
if leftkey()=1 then turn object left 1,1
if rightkey()=1 then turn object left 1,-1
position camera object position x(1),object position y(1),object position z(1)
yrotate camera object angle y(1)
if object collision(1,2) then set cursor 10,10
loop
sync
//Syncing the FPS
SYNC RATE 120
//Controling the camera
DO
CONTROL CAMERA USING ARROWKEYS 0,1,2
LOOP
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 2nd Jun 2016 04:28
Try something like this.

thelighgod
8
Years of Service
User Offline
Joined: 10th Oct 2015
Location:
Posted: 3rd Jun 2016 09:02
Nope it is still letting me walk through walls.
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 3rd Jun 2016 15:31
Yeah, the object hit and collision functions only tell you a collision has occurred. You have to code a response to the collision. I don't know if the Automatic Camera Collision function will work with a static object. But, give it a try.



Here is a modified version of how FPS Creator handles camera movement and collision put into a function.

wattywatts
14
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 4th Jun 2016 17:29
I would suggest using Sparky's for all collision.
thelighgod
8
Years of Service
User Offline
Joined: 10th Oct 2015
Location:
Posted: 18th Jun 2016 10:28
Thanks for all your help

Login to post a reply

Server time is: 2024-04-19 17:00:56
Your offset time is: 2024-04-19 17:00:56