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,405
RINT "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