non-specific Entity Radii

Blitz3D Forums/Blitz3D Programming/non-specific Entity Radii

_PJ_(Posted 2003) [#1]
I am implementing the Laser code from the archives into my game. The laser code stretches a cube primitive out. The dimensions of the stretched cube will vary depending on the type of laser it represents in my game. How can I set collision radii etc. when the dimensions of the cube can be so varied?

Here's the relevant code:

If MilliSecs()-fire_rate>=laser_recharge Then laser_on=False: fire_rate=MilliSecs()

If (MilliSecs()-fire_rate)<(laser_recharge*2) Or laser_on=False Then Return

laser_on=True

If laser>0 Then FreeEntity laser

PlaySound primarysound
fire_rate=MilliSecs()

laser = CreateCube()

EntityRadius laser,XX,YY
EntityPickMode laser,3,0 
EntityType laser,3 

EntityAlpha laser,0.3
EntityShininess laser,0
EntityFX laser,5

PositionEntity laser,EntityX#(ship),EntityY#(ship),EntityZ#(ship)
	
	laser_distance=gun_range/2
	
	ScaleEntity laser,1,1,laser_distance
	PositionEntity laser,EntityX(ship),EntityY(ship),EntityZ(ship)
	PointEntity laser,target_end
	MoveEntity laser,0,0,laser_distance




_PJ_(Posted 2003) [#2]
Um...anyone know?

Neomancer, you wrote it!

I need to know if any part of the laser collides with other objects, will this work okay?