I want to take a vector coordinate and put it into 2d space.
For example, lets say I wanted to get all entities around an origin, and render them onto a panel. like an overview map you could say.
Never really messed with anything like this, just trying to increase my knowledge, so how would I go about this?
To answer your example, why not use [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index2b71.html"]Render.RenderView[/URL]?
uh.. no i'm talking about taking a Vector, and then using that to create something on a panel. like a radar.
Just treat the entities' positions as 2D vectors by ignoring the z-coordinate?
Get the angle of the entity relative to the player and also the distance. Then you can use the following formulas:
x = radius * cos(angle)
y = radius * sin(angle)
[URL]http://en.wikipedia.org/wiki/Polar_coordinate_system#Converting_between_polar_and_Cartesian_coordinates[/URL]
Of course, this is only one of many solutions. This particular solution will allow you to base entities' positions and angles relative to the player's view.
[QUOTE=EvacX;42875968]Just treat the entities' positions as 2D vectors by ignoring the z-coordinate?[/QUOTE]
well yeah, but properly scaling that to the size of the panel it's on, what about that.
[QUOTE=LauScript;42876255]well yeah, but properly scaling that to the size of the panel it's on, what about that.[/QUOTE]
Do you really need help multiplying numbers?
[QUOTE=EvacX;42876299]Do you really need help multiplying numbers?[/QUOTE]
nope i actually just randomly decided to ask for no reason?
Let's say i have Vector(1000,1500,500) or something. obviously i can't just draw something at 1000,1500 in a panel. and the object i am drawing is relative to the panel. what do i need to do to get the right x,y? I can't just "multiply numbers" if i don't know what to multiply.
aaaand your banned. ok.
[QUOTE=LauScript;42876369]nope i actually just randomly decided to ask for no reason?
Let's say i have Vector(1000,1500,500) or something. obviously i can't just draw something at 1000,1500 in a panel. and the object i am drawing is relative to the panel. what do i need to do to get the right x,y? I can't just "multiply numbers" if i don't know what to multiply.
aaaand your banned. ok.[/QUOTE]
Usually radars have range, so say your radar has range of 1000, so any point that is farther than 1000 is not drawn, the rest is drawn to scale, using trigonometry ( Download a radar addon and look how it's done or ask someone who knows how to, if you don't )
well yeah... and i downloaded a radar addon and it was so poorly scripted i can't learn from it.
Sorry, you need to Log In to post a reply to this thread.