Collision problems

Blitz3D Forums/Blitz3D Beginners Area/Collision problems

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.

Hi all.

I'm having a little problem with collisions.

A green cube spins in space, and using the arrow keys you can push up against it.
Collisions are happening as I can't walk through the cube, but I want the cube to turn red when I do collide with it.
I'm not sure why the call to EntityCollided isn't working.

Can someone please help?

Thanks for any suggestions.

Graphics3D 800,600,32,2
SetBuffer BackBuffer()

US=1
THEM=2

Collisions US,THEM,1,2
Collisions THEM,US,1,2

light=CreateLight()
RotateEntity light,90,0,0

camera_pivot=CreatePivot()
PositionEntity camera_pivot,0,0,0
EntityRadius camera_pivot,1.5
EntityType camera_pivot,US

camera=CreateCamera(camera_pivot)

cube=CreateCube()
PositionEntity cube,0,0,5
EntityColor cube,0,255,0
EntityRadius cube,1.5
EntityType cube,THEM

While Not KeyHit(1)
	If EntityCollided(cube,US) EntityColor cube,255,0,0

	If KeyDown(200) MoveEntity camera_pivot,0,0,0.1
	If KeyDown(208) MoveEntity camera_pivot,0,0,-0.1
	If KeyDown(203) TurnEntity camera_pivot,0,1,0
	If KeyDown(205) TurnEntity camera_pivot,0,-1,0

	TurnEntity cube,0.5,0.5,0.5

	UpdateWorld
	RenderWorld
	Flip
Wend