• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Converting coordinates to Screen position, without matrix?

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
how can i convert coodinates to display position without vjass and matrix?

i guess this is the angle if camera not rotated but idk how to get the position :D (like in dgui)

JASS:
local real CamTX = GetCameraTargetPositionX()
local real CamTY = GetCameraTargetPositionY()
local real CamTZ = GetCameraTargetPositionZ()
local real CamSX = GetCameraEyePositionX()
local real CamSY = GetCameraEyePositionY()
local real CamSZ = GetCameraEyePositionZ()
local real ang = bj_RADTODEG * Atan2(CamTZ - CamSZ, CamTY - CamSY)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Yes, that's the "angle of attack". You can use that if camera is rotated :
JASS:
local real ang = bj_RADTODEG * Atan2(CamTZ - CamSZ, SquareRoot((CamTY - CamSY)*(CamTY - CamSY)+(CamTX - CamSX)*(CamTX - CamSX)))
However, I don't get the question. Position of what?

positioning objects on screen, like in dgui, dynamic graphical user interface, so positioning objects (unit) to a fixed position, like hero icons in top left corner, so something like this screenshots

attachment.php

attachment.php


and i know about i need point for get the terrain height but that never was problem,
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Maybe you should use matricies and vectors? Seeing how that is what the GPU does to make the image it is probably a very good idea.

pls read the 1st post, i told i cant use the matrix because i dont want it in vjass, i want try in jass but first of all i want try to understand how to calculate the vectors and other part, because seeing the code with structs done say nothing to me
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,239
What does vjass have to do with matricies and vectors? I am refering to the mathematical opperations.

Solve them by hand (or with the help of tools like mathematica) and you will get an equation that you can produce in JASS that will compute what you are after.
 
Status
Not open for further replies.
Top