@Philip - just started reading your vector tutorial now - nice work! (I like the humour in it, too - makes a dry subject less scary!)
@Gamer:
There are easier ways to get a bullet to move than by using 3D maths equations - commands like turn object, move object etc. are there to make your life easier.
However, if you really want to go the equation route, and what you see in Philips vector tutorial isn't your cup of tea either, anfd you were scared off by all the different variables in my projectile code, then here is some code which uses just maths equations to calculate the position of the bullet given the velocity, the direction (y angle) and the trajectory (angle from the horizontal). No gravity, air resistance, etc.
Use the arrow keys to point the gun, and space to fire. The code's pretty rough, but you could adapt it for your needs without too much trouble. It's remarked so you can see what each bit does.
sync on
autocam off
position camera 0,10,-40
make matrix 1,200,200,10,10
position matrix 1,-100,0,-100
make object box 1,2,2,6 `this is the gun
make object sphere 2,3 `this is the bullet
v#=0.1 `sets velocity
do
`uses arrowkeys to point gun
if rightkey()=1 then angy#=angy#+0.5 `this is the y angle
if leftkey()=1 then angy#=angy#-0.5
if downkey()=1 and traj#<45 then traj#=traj#+0.5 `this is the trajectory
if upkey()=1 and traj#>-45 then traj#=traj#-0.5
`creates imaginary target, positions it according to y angle
`and trajectory, and points gun in that direction
angy#=wrapvalue(angy#)
xt#=object position x(1)+20*sin(angy#)
zt#=object position z(1)+20*cos(angy#)
yt#=object position y(1)+20*tan(traj#)
point object 1,xt#,yt#,zt#
`fires gun
if spacekey()=1
x#=0:y#=0:z#=0
wait 100
gosub fire
endif
text 0,0,"Direction (y angle): "+str$(angy#)
text 0,20,"Trajectory (angle from horizontal): "+str$(traj#)
sync
loop
fire:
do
`here's the maths:
vh#=v#*cos(traj) `calculates horizontal velocity
vy#=v#*sin(traj#) `calculates vertical velocity
vx#=vh#*sin(angy#) `calculates x component of horizontal velocity
vz#=vh#*cos(angy#) `calculates z component of horizontal velocity
`calculates new x,y,x positions
x#=x#+vx#
y#=y#+vy#
z#=z#+vz#
position object 2,x#,y#,z#
`returns to start on key press
if scancode()>0 then return
text 0,0,"Direction (y angle): "+str$(angy#)
text 0,20,"Trajectory (angle from horizontal): "+str$(traj#)
sync
loop
return