MAV on ODE_dBodyAddForce()

Blitz3D Forums/Blitz3D Programming/MAV on ODE_dBodyAddForce()

Never used ODE but it may a division by 0 issue. Adding an offset of 1 or less to dis# should prevent this. For explosions you should be using the inverse distance to calculate the effective intensity.

Function CreatePhysicExplosion(x#, y#, z#, range# = 5, intensity# = 10)

	For pm.PhysicMesh = Each PhysicMesh
		ox# = x# - EntityX(pm\ent)
		oy# = y# - EntityY(pm\ent)
		oz# = z# - EntityZ(pm\ent)
		dis# = Sqr(ox# * ox# + oy# * oy# + oz# * oz# ) + 1 
		Effect# = intensity / ( dis * dis )
		If dis# < range# Then ODE_dBodyAddForce pm\body, ox# * effect#, oy# * effect#, oz# * effect#
	Next
End Function


Not sure if this helps.
Stevie