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 / Need help with collisions

Author
Message
cmpfrance
22
Years of Service
User Offline
Joined: 14th Sep 2002
Location:
Posted: 27th Dec 2002 22:45
Hi,

I'm trying to make a "simple" thing:
- Load a X or 3DS object (a room) (OK),
- move inside (OK),
- Use collisions between the camera and the room (?????).

If I use this (object 2 is the room, object 3 is a cube following the camera):

coll = object collision(3,0)
print coll

I should get "2" when I run into a wall but I always get "0"!

Any idea?

Here is the whole source - it needs to be cleaned, as I started from a tutorial and then changed it, but it is readable.

thanks in advance for your help...

Seb.

-----------------------

CLS
load bitmap "avert.bmp",1
set current bitmap 1
get image 1,0,0,360,470
set current bitmap 0
paste image 1,115,1


Avert:
n#=scancode()
if n#=57 then goto Debut else goto Avert

Debut:
delete bitmap 1
CLS
LOAD SOUND "mus.wav",1
PLAY SOUND 1
load bitmap "intro.bmp",1
set current bitmap 1
get image 1,0,0,300,400
set current bitmap 0
paste image 1,140,1


set cursor 200,405:print "1 - 640x480"
set cursor 200,425:print "2 - 800x600"
set cursor 200,445:print "3 - 1024x768"
set cursor 310,425:input "Résolution?";res#


if res#=1 then set display mode 640,480,16:goto Suite
if res#=2 then set display mode 800,600,16:goto Suite
if res#=3 then set display mode 1024,768,16:goto Suite

set cursor 190,460:print "Merci d'indiquer seulement le numéro!":sleep 2000:goto Debut

Suite:

SYNC ON
SYNC RATE 80

CLS
set cursor 200,405RINT "Chargement en cours..."
load bitmap "interf.bmp",1
set current bitmap 1
get image 1,0,0,531,89
set current bitmap 0
load object "maison2.x",2
rem set object collision to polygons 2

make object cube 3,2
make object cube 4,5


scale object 2,40,40,40
position object 2,0,-55,100
position object 4,0,10,-500

position camera 0,10,-1200


make light 1
set point light 1,1,1,1

hide mouse
x=0
y=0
z=0
v=4
angle#=0

do


if SOUND PLAYING(1)=0 then play sound 1
if v50 then anglex#=50
if n#=74 then v=v-1
if n#=78 then v=v+1

INK RGB(255,100,0),RGB(0,0,255)
set cursor 440,25:
SET TEXT TO BOLD
SET TEXT SIZE 18
print v

set cursor 480,48:
SET TEXT TO BOLD
SET TEXT SIZE 18
if anglex#0 then val=0-wrapvalue(anglex#)
if anglex#=0 then val=0
print val;"°"

move camera z
yrotate camera wrapvalue(angle#)
xrotate camera wrapvalue(anglex#)

rem ----------récupération de données de la caméra
x1#=camera position x()
y1#=camera position y()
z1#=camera position z()

rem ----------position de l' objet a la meme position que la caméra
x2#=x1#+50
position object 3,x1#,y1#,z1#
set global collision on

z=0
automatic camera collision 0,10,1
sync
loop
cmpfrance
22
Years of Service
User Offline
Joined: 14th Sep 2002
Location:
Posted: 27th Dec 2002 22:56
By the way, object 4 is a box I used to try collisions with the one that's following the camera, and this works. It works with an object created by DBPro, but not with an external object "X/3DS).

Seb.

cmpfrance
22
Years of Service
User Offline
Joined: 14th Sep 2002
Location:
Posted: 31st Dec 2002 02:23
Forget it, I've got the solutions: the directX files made by Cinema4D can be loaded by DB but the collisions don't work; I used a converter instead (from C4D to 3DS, then 3DS to X) and it works now.

Login to post a reply

Server time is: 2024-11-23 20:00:24
Your offset time is: 2024-11-23 20:00:24