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.

Newcomers DBPro Corner / yet even another collision question

Author
Message
JABBER
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Indiana, USA
Posted: 18th Mar 2005 05:41
With the camera working, I put my time into collisions, think I've read most if not all the past posts on the topic, even raided the code base,Want to see what you guys find in the code
Rem Project: Shooting_range
Rem Created: 3/15/2005 11:15:09 PM

Rem ***** Main Source File *****

backdrop off : hide mouse

rem Setup camera
set camera range 1,10000

load object "shooting_range.x",1
scale object 1,200,200,200
set object collision to polygons 1
disable object zdepth 1

load object "sky_box.3ds",2

Make Object Sphere 5, .1
`set up its collision method
Set Object Collision to polygons 5

set ambient light 55
position camera 0,0,4,-8

cpx#= camera position x()
cpz#= camera position z()
cpy#= camera position y()
cmx#=1
cmz#=-5
a#=0
b#=0
f=100

set global collision on

do
position object 5,cpx#,cpy#,cpz#

col=object collision (1,5)
if col<>0 then print "HIT!!!!!!!!"

rem Create simple sprite based crosshair
sprite 1,512,384,1
set sprite 1,0,1
size sprite 1,25,1
offset sprite 1,12.5,0
sprite 2,512,384,1
set sprite 2,0,1
size sprite 2,1,25
offset sprite 2,0,12.5

camSpeed#=.05


cam_x# = CAMERA ANGLE X() + MOUSEMOVEY() * .5
cam_y# = CAMERA ANGLE Y() + MOUSEMOVEX() * .5
cam_z# = CAMERA ANGLE Z() + MOUSEMOVEZ() * .5

IF INKEY$() = "w"
MOVE CAMERA CamSpeed#
XROTATE CAMERA cam_x#
ENDIF

IF INKEY$() = "s"
MOVE CAMERA CamSpeed#*-1
XROTATE CAMERA cam_x#
ENDIF

IF INKEY$() = "a"
ROTATE CAMERA 0, cam_y#-90, 0
MOVE CAMERA CamSpeed#
ROTATE CAMERA cam_x#, cam_y#, 0
ENDIF

IF INKEY$() = "d"
ROTATE CAMERA 0, cam_y#+90, 0
MOVE CAMERA CamSpeed#
ROTATE CAMERA cam_x#, cam_y#, 0
ENDIF



if cam_x#>50 then cam_x#=50
if cam_x#<-50 then cam_x#=-50

ROTATE CAMERA cam_x#, cam_y#, cam_z#

position camera cpx#,cpy#-0.001,cpz#

sync

loop



when it starts up the camera seems to be stuck in the ground, it will rotate, but I can not move. I've stuck a " if col<>0 then print "hit!!!" to list a collision, but none are detected, Thanks again m8tes!


hope I have the 's right
JABBER
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Indiana, USA
Posted: 18th Mar 2005 05:43
AHHHHH! soory about that (,/)placement
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 22nd Mar 2005 02:02
Quote: "position camera cpx#,cpy#-0.001,cpz#"

This line keeps putting the camera back in the cpx/y/z position, but those variables never change in the loop. It looks like you can just delete it and it will work. I suspect that you meant to Position Object instead of Position Camera. If you did, you will also need to set those variables to Camera Position X/Y/Z() within the loop.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II

Login to post a reply

Server time is: 2024-11-13 19:58:41
Your offset time is: 2024-11-13 19:58:41