Page 1 of 1

3d-Shooter in PureBasic

Posted: Mon Oct 31, 2005 8:13 pm
by Mr.Hahn
Hi,
I´ve got some Expirience in PureBasci in 2D and Sprite Games, but in the newest Version there is the OGRE engine, so I wanted to code a 3d shooter.
But I´ve got some Problems with that. I have already the terrain, a skyBox and a robot moving around animated.
But I have no Idea how to Fire a Bullet in the Direction the Camera is facing! I can only let it fly in the X or the Z direction! Is there a Command to send the bullet into the direction where the camera is facing?

PS.: Maybve someone has already programmed a little 3d shooter, if someone still has the code of something like that, coul d you please send it to me?

Posted: Mon Oct 31, 2005 11:07 pm
by Psychophanta
You need to know the 3 angles of the robot respect the world absolute 3 axis (x, y and z). (If you know only 2 of the 3 angles, then you must choose 1 from 2 only posible cuadrants).
The vector for bullet movement is:
vx=speed*cos(anglex)
vy=speed*cos(angley)
vz=speed*cos(anglez)
('speed' is the bullet speed choosed by you)

Else you need to know the 3 angles of the robot respect the world absolute 3 planes. (again, if you ignore one of them then you must choose 1 of only 2 possible cuadrants).
In this case the vector would result:
vx=speed*sin(angle_yz)
vy=speed*sin(angle_xz)
vz=speed*sin(angle_xy)

example XD

Posted: Mon Apr 17, 2006 3:43 am
by zefiro_flashparty
(programer cardiacs NOT READ , DUNGEROUS CODE HEALT HERE XD
for an HERETIC programer ;P
yes mi code is bad.. im noob :P gusshhh not read XD
i write this code long time ago, in free demo of pb =)
use more includes but the limit of lines of source

well see the calcle of rotate cam and proyection of point of view
first i rotate the cam and the mesh but not rotate = and later
calculate the point of view and onli change the look at positions
emm the colision is radial and simple. the copter colision whit person and jeep XD need a variable of altitude.... never add XD
not shot, but i dont more free lines to continue XD in demo version and
avandone the proyect, the models is converted to ogre from condition zero, whit milkshape (previus retexturize) the model not is animated.. XD
never cant export the animation to model in ogre :(
if see a player runing , these is a split of more models , no texturized to see , but y change model , how sprities :S, only test it ,but not see convincent, the model of the floor is a rectangle , and have errors but y put 2 rectangles , the sky is an cubet inverted , the skidome never work in mi pc :(, and the controls is

to move player
w
asd and mouse

to move helicopter
e r t
efg

to move jeep
j
nm
k

i upload the example in this link

http://rapidshare.de/files/18198008/pbf ... d.zip.html

enjoy :D , select free, and whait 20 seconds to download =) :shock:

Posted: Mon Apr 17, 2006 3:52 am
by dagcrack
gusshhh not read XD
How Can't I read when you give me the post link... Anyway, the zip does not contain any sources. It's not really a help for anyone in such case.

ops sources not includes XD sorry :P

Posted: Mon Apr 17, 2006 9:05 pm
by zefiro_flashparty
:oops: :roll: well
i dont have idea but not add the sources in zip :S
here add the link whit sources and compiler exe

:? well , here is the code..

(is mi first code in pb) i write the code in one day..
meybe if have time reedit the source


http://rapidshare.de/files/18262554/source.zip.html