3D radar HELP please

Blitz3D Forums/Blitz3D Programming/3D radar HELP please

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.

Does this help?

And this!

Malice: Sorry, thats a bit vague.

Maybe try the other or that instead?

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.

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.

Yeah, this is similar to what I used here:

;ELITE RADAR

If flight_mode$="Space" 

		DrawImage eliteimage,eliteX,EliteY





		For RadDots.RadarTargets = Each RadarTargets

			If EntityDistance(RadDots\TargetEntityhandle,ship)<=radar_range#

				If RadDots\TargetType$<>"PLANET" And RadDots\TargetType$<>"STAR" And RadDots\TargetType$<>"SATELLITE"

					TFormPoint (EntityX#(RadDots\TargetEntityhandle,1),EntityY#(RadDots\TargetEntityhandle,1),EntityZ#(RadDots\TargetEntityhandle,1),0,ship) 
					red_relativeX#=(0-TFormedX#())
					red_relativeY#=(TFormedY#())
					red_relativeZ#=TFormedZ#()

					red_relativeX#=(red_relativeX#/radar_scale#)
					red_relativeY#=(red_relativeY#/(radar_scale#*1.5))
					red_relativeZ#=(red_relativeZ#/(radar_scale#*1.5))

					Color RadDots\TargetColourRed,RadDots\TargetColourGreen,RadDots\TargetColourBlue
						If targetentity=RadDots\TargetEntityhandle Then Color 255,255,255

					;blip
					;If red_relativeY>0 Then Rect (red_relativeX#+1)-elitex,(red_relativeZ#+Abs(red_relativeY#)+Abs(red_relativeY#))-elitey,3,1,1 
						If red_relativeY<0 Then Rect eliteX-(red_relativeX#+1),eliteY-red_relativeZ#+Abs(red_relativeY#)+Abs(red_relativeY#),3,1,1 

					;stalk
					If red_relativeY>0 Then Rect (eliteX-red_relativeX#)-1,eliteY-red_relativeZ#-Abs(red_relativeY#),2,Abs(red_relativeY#),1 
					If red_relativeY<0 Then Rect eliteX-red_relativeX#,eliteY-red_relativeZ#+Abs(red_relativeY#),1,Abs(red_relativeY#),1 

				EndIf

			EndIf


		Next

EndIf


Notes: I used different colours for different object types.

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


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.