Greetings. I am pretty new to Blitz3D and this is my first post on this site.
I am currently having a problem with a first person shooter that I am attemping to make.
The problem is that when ever I shoot my bullet, it appears to rotate where my gun is so that when I turn 180% around the bullets fire from a different position than where I intended (the barrel of the gun).
I've tried to solve this on my own and haven't figured it out.
As I've observed on this website, it appears to help to give an example of code, so here it is:
If I typed any commands wrong, it's becaus I had to retype all that code.
The computer with Blitz3D doesn't have internet access.
I tried to include everything that I assumed you needed but if I missed anything important then just let me know.
Thanks in advance!
I am currently having a problem with a first person shooter that I am attemping to make.
The problem is that when ever I shoot my bullet, it appears to rotate where my gun is so that when I turn 180% around the bullets fire from a different position than where I intended (the barrel of the gun).
I've tried to solve this on my own and haven't figured it out.
As I've observed on this website, it appears to help to give an example of code, so here it is:
;FPS Graphics3D 1024,764 SetBuffer BackBuffer() light=CreateLight() ;Creating the camera and pivot piv=CreatePivot(cam) cam=CreateCamera() TranslateEntity piv,EntityX(cam),EntityY(cam),EntityZ(cam) ScaleEntity cam,1,1,1 ;Creating a plane plane=CreatePlane() PositionEntity plane,0,-2,0 EntityColor plane,0,255,0 ;Creating the gun gun=LoadMesh("C:\Program Files\AutoDesk\3DsMax8\meshes\Gun.3ds") PositionEntity gun,.2,-.25,.5 ScaleEntity gun,.005,.005,.005 RotateEntity gun,0,90,-90 EntityParent gun,cam ;How far the camera can see cam_range=10000 ;How near the camera can see CameraRange cam,.1,cam_range ;Creating the bullets fullmag=100 Dim bullet(fullmag) For i=0 To fullmag bullet(i)=CreateSphere() ScaleEntity bullet(i),.2,.2,.4 HideEntity bullet(i) Next ;Function CurveValue Function CurveValue#(current#,destination#,curve) current#=current#+((destination#-current#)/curve) Return current# End Function ;Running the program While Not KeyDown(1) ;Mouse controls mxs=MouseXSpeed()*.25 mys=MouseYSpeed()*.25 dest_xangle#=dest_xangle#+mys dest_yangle#=dest_yangle#-mys xangle#=CurveValue#(xangle#,dest_xangle#,3) yangle#=CurveValue#(yangle#,dest_yangle#,3) RotateEntity cam,xangle#,yangle#,0 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 ;Firing bullets If MouseHit(1) Then ShowEntity bullet(t) PositionEntity bullet(t),EntityX(gun,1)+.5,EntityY(gun,1)-1.5,EntityZ(gun,1) RotateEntity piv,EntityPitch#(cam,1),EntityYaw#(cam,1),EntityRoll#(cam,1) RotateEntity bullet(t),EntityPitch#(piv,1),EntityYaw#(piv,1),EntityRoll#(cam,1) t=t+1 EndIf For q=0 To fullmag MoveEntity bullet(q),0,1,3 Next RenderWorld Flip Wend End
If I typed any commands wrong, it's becaus I had to retype all that code.
The computer with Blitz3D doesn't have internet access.
I tried to include everything that I assumed you needed but if I missed anything important then just let me know.
Thanks in advance!