beam rifle

Blitz3D Forums/Blitz3D Beginners Area/beam rifle

I dont know how to use the vertex creation code in blitz3d

how could i create a beam rifle type of shot like in gears of war, the sniper rifle i mean.

You could just use the createcylinder parameter in blitz. If you create multiple cylinders, at slightly different sizes, and use the add blend mode, you can get some decent beams going.

Like This?

Hold space to make a beam

Graphics3D 800,600,0,2
SeedRnd MilliSecs()
SetBuffer BackBuffer()
Global light = CreateLight(2)
Global camerapivot= CreatePivot()
Global camera = CreateCamera(camerapivot) 

Setup3d()

Type Link
	Field E
End Type 


While Not KeyDown(1)
Cls


If KeyDown(203) Then TurnEntity Camerapivot,0,1,0
If KeyDown(205) Then TurnEntity Camerapivot,0,-1,0
If KeyDown(200) Then MoveEntity CameraPivot,0,0,1
If KeyDown(208) Then MoveEntity Camerapivot,0,0,-1


If KeyDown(57)
NewLink()
EndIf 
UpdateLinks()


UpdateWorld()
RenderWorld()
Flip 
Delay 1
Wend


End  


Function NewLink()
	L.Link=New Link
	L\E=CreateCylinder(6)
        EntityColor L\e,255,0,0
	RotateMesh L\e,90,0,0
	ScaleEntity L\e,.1,.1,2
Return
End Function 
Function UpdateLinks()
	For L.Link=Each LInk
		MoveEntity L\e,0,0,1
	Next
Return
End Function 


Function Setup3d()
SetBuffer BackBuffer()
SeedRnd MilliSecs() 
If Light <> 0 
RotateEntity light, 90,0,0
LightColor Light,255,255,255
PositionEntity Light,0,100,0
LightRange Light,100000
EndIf 
EntityRadius camerapivot,1
CameraRange camera,1,100
CameraFogMode camera,1
CameraFogRange camera,60,100
PositionEntity camerapivot,0,2,0
PositionEntity camera,0,30,30
PointEntity Camera,Camerapivot
Return 
End Function 


thats really cool but not what i was meaning, i mean a hit scan weapon, one that picks the target then creates the beam to the length that the target is away from the origin