Page 1 of 1

Move a Bullet in your 3d world

Posted: Wed Jun 11, 2003 9:12 pm
by WolfgangS
Hi Community
If you want a straight flying bullet you can use this formulas:

Code: Select all

If ExamineMouse()
   MouseX = -MouseDeltaX()/2
   MouseY = -MouseDeltaY()/2
   CameraDirectionX+MouseX
   CameraDirectionY+MouseY
   If MouseButton(1)   ; left MouseButton (nervous trigger finger ;)
     ; get the start coordinates 
     LocateX=CameraX(#YourCam)
     LocateY=CameraY(#YourCam)
     LocateZ=CameraZ(#YourCam)
     
     ; and calculate the deltaXYZ coordinate just one time!
     deltaY= gcos(CameraDirectionX) * gcos(CameraDirectionY) * Speed
     deltaX=-gsin(CameraDirectionX) * gcos(CameraDirectionY) * Speed
     deltaZ= gsin(CameraDirectionY)                          * Speed 
   Endif
Endif

and then and move the shot with the calculated values...

Code: Select all

If active
   LocateX + deltaX
   LocateY + deltaY
   LocateZ + deltaZ
   EntityLocate(#bullet,LocateX,LocateY,LocateZ)
EndIf



      RotateCamera(#YourCam, MouseX, MouseY,0)
      RenderWorld()

Updated for 3.70 ;)

I hope this is understandable.
MFG
WolfgangS

Posted: Wed Jun 11, 2003 9:35 pm
by Num3
Forgot bullet time function ;)

Posted: Wed Jun 11, 2003 11:20 pm
by Fred
You should use EntityLocate() instead of old MeshLocate(). A mesh is no more a movable object...

It isn´t working anymore with 3.70

Posted: Mon Jun 16, 2003 12:47 pm
by WolfgangS
Hi !
i figured out the formulas aren´t working with PB 3.70 anymore. I have no clue what happend.
You can get a small example here: www.schliess.com/stuff/8_3.zip and check the formulas for yourself.

Do have anyone else has a working example of a shot in a 3d Room ?

MFG
:cry: WolfgangS