pushing

Blitz3D Forums/Blitz3D Beginners Area/pushing

How do I get the camera to push small objects aside when moving thru my level?

You could do it like this:
Graphics3D 800, 600, 0, 2
SetBuffer BackBuffer()

plane = CreatePlane()
MoveEntity plane, 0, -1, 0
EntityColor plane, 0, 255, 0

sphere = CreateSphere()
camera = CreateCamera()
MoveEntity camera, 0, 5, -15
PointEntity camera, sphere
EntityParent camera, sphere
EntityType sphere, 1

For i = 0 To 20
	
	cube = CreateCube()
	EntityType cube, 2
	PositionEntity cube, Rand(-30, 30), 0, Rand(20, 70)
	EntityColor cube, Rand(255), Rand(255), Rand(255)

Next


Collisions 1, 2, 2, 3

Repeat

	If KeyDown(203) Then TurnEntity sphere, 0, +1, 0
	If KeyDown(205) Then TurnEntity sphere, 0, -1, 0
	If KeyDown(200) Then MoveEntity sphere, 0, 0, +0.5
	If KeyDown(208) Then MoveEntity sphere, 0, 0, -0.5
	
	UpdateWorld()	
	
	For i = 1 To CountCollisions(sphere)
		
		ent = CollisionEntity(sphere, i)
		dd# = EntityDistance(sphere, ent) - 2.0
		nx# = CollisionNX(sphere, i) * dd
		ny# = CollisionNY(sphere, i) * dd
		nz# = CollisionNZ(sphere, i) * dd
		MoveEntity ent, -nx, -ny, -nz
		
	Next
	
	RenderWorld()
	Flip
	
Until KeyHit(1)


End

But I think the best way is to use a physics library.