bullet prolem(change direction of bullet with gun)

Blitz3D Forums/Blitz3D Beginners Area/bullet prolem(change direction of bullet with gun)

Braden(Posted 2008) [#1]
hi,
I'm having a problem with my bullets, When I turn my gun, the bullets don't follow...How do I make it follow?
Also! I did search the forums for the anwser, but I don't think I found it...

here is the code...



any help would be appreciated! thanks!


Ace Killjoy(Posted 2008) [#2]
I may be able to help on this.
Try parenting the bullet to the camera (or gun) and when the bullet fires make the parent of the bullet '0' by typing "ParentEntity bullet(t),0".

Also, try putting this code under "PositionEntity bullet(t),EntityX(gun,1),EntityY(gun,1),EntityZ(gun,1)":


I believe I know where you got this code from.
I'll try looking at my own code and see if I can find anything.


H. T. U.(Posted 2008) [#3]
Just turn the bullets to the pitch, yaw, and roll of the gun. Otherwise, they will always go in the same direction (you could also change "MoveEntity bullet(q),.3,.5,3" to "MoveEntity bullet(q),0,0,3").

Edit: By the way, I personally don't use parents, I've always had collision problems with them (I use a few entity position and rotation commands instead). Besides, they're too unpredictable :^)


Braden(Posted 2008) [#4]
HAH! thanks, I added the "entityparent bullet(t),0" and the

RotateEntity bullet(t),EntityPitch#(cam,1),EntityYaw#(cam,1),EntityRoll#(cam,1)

and it worked really well! thanks!


Ace Killjoy(Posted 2008) [#5]
Well, glad to hear that you figured it out.
I found something different in my code but it probably doesn't matter.


Pongo(Posted 2008) [#6]
You should check out WolRon's FPS example here: http://home.cmit.net/rwolbeck/programmingtutorial/

That link isn't completely working, but there is a link on the left side. Here is a link to that tutorial directly
http://home.cmit.net/rwolbeck/programmingtutorial/code/FPS%20basic%20example.htm




It should help you quite a bit with some of the basic problems you are having, and also give you a bit more structure to your code that will make it easier to read.


Braden(Posted 2008) [#7]
thanks