Gravity on a Mesh Terrain

Blitz3D Forums/Blitz3D Beginners Area/Gravity on a Mesh Terrain

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.

Thought so! Here's an intermediary solution, although you may have to give the wider system a bit more thought (depends on whether you're happy with air acceleration still being generated when stationary). I've included some bits of original code around the new snippet so you can see where to insert it...

		If KeyDown(17) cz# = cam_speed * mmod * air_accel
		If KeyDown(31) cz# = -cam_speed * mmod * air_accel
		If KeyDown(17) = 0 And KeyDown(31) = 0
			cz# = 0
		EndIf
		
		If KeyDown(32) cx# = cam_speed * mmod * air_accel
		If KeyDown(30) cx# = -cam_speed * mmod * air_accel
		If KeyDown(32) = 0 And KeyDown(30) = 0
			cx# = 0
		EndIf
		
		ClearCollisions
		If cz#+cx#=0 ; OUCH! COMPARING FLOATS TO AN INT IS A BAD HABIT - CONSIDER THIS VERY TEMPORARY
			Collisions CT_PLAYER,CT_TERRAIN,2,1
			Collisions CT_FEET,CT_TERRAIN,2,1
		Else
			Collisions CT_PLAYER,CT_TERRAIN,2,2
			Collisions CT_FEET,CT_TERRAIN,2,2
		EndIf
			
		MoveEntity campiv,0,0,cz
		MoveEntity campiv,cx,0,0


Now. I owe myself a brew.