Collision detection and response ( with codes )

Advanced game related topics
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post by Comtois »

I have a question about shoot 3D
I write this , but Direction\y is not correct. Does someone know how to do ?

Code: Select all

MouseX = -(MouseDeltaX()/20) * InfosNinja\Vitesse / (3 + 5.0/Fov) 
MouseY = -(MouseDeltaY()/20) * InfosNinja\Vitesse / (3 + 5.0/Fov)

Camera\AngleX = M3D_WrapValue( Camera\AngleX + MouseX)
RotateCamera(0,MouseX,0,0)

If MouseY > 0 And Camera\AngleY < 75
   Camera\AngleY + MouseY 
   RotateCamera(0,0,MouseY,0) 
ElseIf MouseY < 0 And Camera\AngleY > -75
   Camera\AngleY + MouseY 
   RotateCamera(0,0,MouseY,0) 
EndIf

;Shoot 
Rayon\Direction\x = M3D_Cos(Camera\AngleX)  
Rayon\Direction\y = M3D_Sin(Camera\AngleY)
Rayon\Direction\z = -M3D_Sin(Camera\AngleX) 
To see what i mean , Source and exe are available here (213 ko without DATA , i use always the same):
http://perso.wanadoo.fr/comtois/sources ... utData.zip
Please correct my english
http://purebasic.developpez.com/
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post by Comtois »

ok found the bug , now it work.

Code: Select all

Rayon\Direction\x = COS_DEG(Camera\AngleX) 
Rayon\Direction\y = TAN_DEG(Camera\AngleY)
Rayon\Direction\z = -SIN_DEG(Camera\AngleX) 
Added robot and vision.

Download (408 ko)

If you have changes you've made with optimizations, etc, please post them and I will include them.

Image


[EDIT]
Temple without lightmap , i added light in the program.
Temple (798 ko)
Last edited by Comtois on Sat Mar 25, 2006 11:31 pm, edited 2 times in total.
Please correct my english
http://purebasic.developpez.com/
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Very nice demo :shock: !
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post by Comtois »

Please correct my english
http://purebasic.developpez.com/
Post Reply