collisions/gravity help

Blitz3D Forums/Blitz3D Beginners Area/collisions/gravity help

other than the countcollisions method, is there any way to say "when this collides with that, do this"? also, if i were to put inside the loop "translateentity player, 0,-0.3,0" (with a slide collision on the ground), would the player fall down, and slide downwards in a slope on the ground? (i dont like that effect, so im trying to find a collisions method in which i can say "if the player is not colliding with the ground, loop a translation downwards")

any help is greatly appreciated :D

There is also the EntityCollided command, you can use it to test if a certain object has collided with an object with a specified collisiontype.

i know about that...the description makes it sound like it checks if it has in the past, or is currently colliding with the types. that wouldnt work for a gravity system

I think you can use it as you described:
Graphics3D 800, 600, 0, 2
SetBuffer BackBuffer()

For j = 0 To 256
For i = 0 To 256
	cc = Sin((i-128) * (j-128) / 60) * 64 + 127
	WritePixel i, j, cc Shl 16 + cc Shl 8 + cc
Next
Next
Flip

im = CreateImage(256, 256)
GrabImage im, 0, 0
SaveImage im, "rndterrain.bmp"

terrain = LoadTerrain("rndterrain.bmp")
DeleteFile "rndterrain.bmp"
ScaleEntity terrain, 1, 50, 1
PositionEntity terrain, -128, -50, -128
TerrainShading terrain, 1
EntityType terrain, 2

light = CreateLight()

camera = CreateCamera()
MoveEntity camera, 0, 5, -128

orgsphere = CreateSphere()
EntityColor orgsphere, 255, 0, 0
EntityType orgsphere, 1
HideEntity orgsphere

Collisions 1, 2, 2, 3

Repeat

	If KeyDown(200) Then MoveEntity camera, 0, 0, +1
	If KeyDown(208) Then MoveEntity camera, 0, 0, -1

	If KeyDown(203) Then MoveEntity camera, -1, 0, 0
	If KeyDown(205) Then MoveEntity camera, +1, 0, 0
	
	If fall Then
		If Not(EntityCollided(sphere, 2))
			TranslateEntity sphere, 0, -0.5, 0
		Else
			fall = False
		End If
	Else
		sphere = CopyEntity(orgsphere)
		PositionEntity sphere, Rnd(-128, 128), 0, Rnd(-128, 128)
		ResetEntity sphere
		fall = True	
	End If
	
	UpdateWorld()
	RenderWorld()
	Flip
	
Until KeyHit(1)

End

However, another thing you could try is using a LinePick from the entity down to determine if an object is below it.

ok that works, thanks a bunch