Collisions -sample code-

Blitz3D Forums/Blitz3D Bug Reports/Collisions -sample code-

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Graphics3D 640,480,16,2

Const UPS=60

cam=CreateCamera()

l=CreateLight()

period=1000/UPS
time=MilliSecs()-period

Global s1=CreateSphere()
Global s2=CreateSphere()

Const spaceship_type=1

EntityType s1,spaceship_type
EntityType s2,spaceship_type
EntityPickMode s1,2
EntityPickMode s2,2
EntityRadius s1,1,0.1
EntityRadius s2,1,0.1
Collisions spaceship_type,spaceship_type,1,1
ScaleMesh s2,1,.1,1
ScaleMesh s1,1,.1,1

PositionEntity s1,0,0,-50
PositionEntity s2,0,0,50

RotateEntity s1,0,0,0
RotateEntity s2,-100,0,0

PositionEntity cam,0,10,50
RotateEntity cam,90,0,0

Repeat
	Repeat
		elapsed=MilliSecs()-time
	Until elapsed
	ticks=elapsed/period
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period

MoveEntity s1,0,0,1


		If KeyHit(1) End
		UpdateWorld	
	Next
	
	RenderWorld tween
	Flip

Forever


the disc stops short of the other disc even though it should touch

the problem seems to be with the Y argument of the entityradius.