Bullet Problem

Blitz3D Forums/Blitz3D Beginners Area/Bullet Problem

Ace Killjoy(Posted 2008) [#1]
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!


Stevie G(Posted 2008) [#2]
There are various methods but if you change this part ...

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


To ...

If MouseHit(1) Then
ShowEntity bullet(t)
entityparent bullet(t), gun
positionentity bullet(t), .5,-1.5,0   ;??
rotateentity bullet(t),0,0,0
entityparent bullet(t), 0
t=t+1
EndIf


It should work for you. Not sure about the .5, -1.5 offsets - note that these will be the local coords relative to the gun so you may want to play with them.

Stevie


Ace Killjoy(Posted 2008) [#3]
Excellent!
Thank you very much.
I did have to tweak the numbers a bit but it will work.
I find it strange that sometimes the 0,0,0 dosn't always mean x,y,z.
That I don't understand but I'm sure I'll get used to it.