3D radar HELP please

Blitz3D Forums/Blitz3D Programming/3D radar HELP please

Strider Centaur(Posted 2005) [#1]
Hi, Im presently trying to make a 3D radar system for use in a game( the fables Under Water Demo ) Iv been on for a while now.

Anyway, what Im trying to create is a sphere with the player represented by a small blip(very small sphere) in the midle and all near by moving objects as small cubes( color coded). The distance of the cube from the small sphere is relative to the actual distance but scaled to a ratio as to fit inside the Radar sphere. The max range of the radar only needs to be about 250meters ( or 250 units ).

Smilertoo has already told me I need to look into Polar Coords( thank Smillertoo ) but if anyone has any additional ideas, Id love to see them. :)

Any thanks in advance.


_PJ_(Posted 2005) [#2]
Does this help?

And this!


Strider Centaur(Posted 2005) [#3]
Malice: Sorry, thats a bit vague.

Maybe try the other or that instead?


_PJ_(Posted 2005) [#4]
Well, I just wondered if using a similar principle, and the TFormPoint command should be what you are looking for. My 'radar' was displayed as 2D, however, instead of a 3D representation as you wanted. I used lines to show height above/below a central point.

You will have to figure out the scale yourself, depending on distances needed, size of meshes and the size of your radar display of course.


Ross C(Posted 2005) [#5]
Well, for one, i'd keep all my entities inside a type list. So when your doing your radar, simply loops through all the entity. Do a distance check on each one to see if they will be displayed on radar. If so, display a cube at it's position. Watch out though. You don't want too many things on radar, as it will add to your surface count. 'll knock together an example for ya.


_PJ_(Posted 2005) [#6]
Yeah, this is similar to what I used here:



Notes: I used different colours for different object types.


Ross C(Posted 2005) [#7]
Hey, something quick i did. I need to go out now, so it isn't 100% decent:

Graphics3D 800,600
SetBuffer BackBuffer()


Global camera = CreateCamera()
CameraRange camera,0.1,1000

Global light = CreateLight()

Global radar = CreateSphere(5)
EntityParent radar,camera
ScaleEntity radar,0.2,0.2,0.01
PositionEntity radar,0.7,-0.3,1
EntityFX radar,1
EntityColor radar,100,100,255

Global player_radar_ent = CreateSphere()
EntityParent player_radar_ent,radar
ScaleEntity player_radar_ent,0.05,0.05,0.05
PositionEntity player_radar_ent,0,0,-2
EntityFX player_radar_ent,1

Type entity
	Field ent
	Field radar_ent
	Field e_type ; 0 = player, 1 = enemy
End Type


For loop = 1 To 20
	e.entity = New entity
	e\ent = CreateCube()
	e\radar_ent = CreateCube()
	EntityParent e\radar_ent,radar
	EntityFX e\radar_ent,1
	ScaleEntity e\radar_ent,0.05,0.05,0.05
	PositionEntity e\ent,Rnd(-20,20),0,Rnd(-20,20)
	HideEntity e\radar_ent
Next



While Not KeyHit(1)



	If KeyDown(200) Then MoveEntity camera,0,0,0.1
	If KeyDown(208) Then MoveEntity camera,0,0,-0.1
	If KeyDown(203) Then TurnEntity camera,0,1,0
	If KeyDown(205) Then TurnEntity camera,0,-1,0
	
	updateradar()
	UpdateWorld
	RenderWorld
	Flip
Wend
End

Function updateradar()

	For e.entity = Each entity
		If EntityDistance#(e\ent,camera) < 10 Then
			ShowEntity e\radar_ent
			x_dif# = EntityX(e\ent,True) - EntityX(camera,True)
			z_dif# = EntityZ(e\ent,True) - EntityZ(camera,True)
			PositionEntity e\radar_ent,x_dif/10,z_dif/10,-1
		Else
			HideEntity e\radar_ent
		End If
	Next
	
End Function



Strider Centaur(Posted 2005) [#8]
Thanks guys for all your help.

Malice, I love the Elite style radar but wanted to do something more 3Dish. Still awesome radar.

RossC, thanks, I have all the entitys in a type by and will be trying out your postional methods.

I ended up using a Vierport and a seperate Camera for now to render the radar on the screen(mad it real easy to position on screen ).

Thanks again all. The source for the project and all of the model and what not should be up for download soon.