Emilio_M Posted March 12, 2015 Posted March 12, 2015 Hi guys. Today i want you for one thing.. Everywhere we see dxDraw(text, rectangle, line etc... ) with world position : https://wiki.multitheftauto.com/wiki/Ge ... ldPosition Ok but how to calculate the correct x and y position of the screen ( with perspective : distance ) ? I 're not found a tutorial or help about that with google. How To make a correct Progress Bar with DX ? Thanks to all !
Castillo Posted March 12, 2015 Posted March 12, 2015 You mean that you want to draw something in a world position, but you want it to keep the same scale? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Emilio_M Posted March 12, 2015 Author Posted March 12, 2015 Yes. Draw with world position with different scale due to the distance with the world point.
JR10 Posted March 12, 2015 Posted March 12, 2015 Use getDistanceBetweenPoints2D/3D and then do some calculations. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
xXMADEXx Posted March 13, 2015 Posted March 13, 2015 I used the calculations from this script. https://community.multitheftauto.com/in ... ls&id=3090 The Ultimate Lua Tutorial! | MTA PHP SDK
Emilio_M Posted March 13, 2015 Author Posted March 13, 2015 Okay thanks. But now, i want to draw a progress bar, how to calculate the correctly position with the % of the progress bar with distance included. ? Thanks.
Emilio_M Posted March 13, 2015 Author Posted March 13, 2015 I used the calculations from this script.https://community.multitheftauto.com/in ... ls&id=3090 On dxDrawText there is scale but on dxDrawRectangle there is no scale. What is the calculs for rectangle ? Thanks.
Addlibs Posted March 13, 2015 Posted March 13, 2015 width = actualWidth - ( actualWidth * (distance/maxDistance) ) height = actualHeight - ( actualHeight * (distance/maxDistance) ) Previously known as MrTasty.
darhal Posted March 13, 2015 Posted March 13, 2015 Here is my idea its also work : 1: You get the x position of the rectangle when the progress is 100%(eg: 345) 2: you do this calculation 100% -> 345 X -> ? ? =( 345÷100)*X #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
Emilio_M Posted March 13, 2015 Author Posted March 13, 2015 width = actualWidth - ( actualWidth * (distance/maxDistance) ) height = actualHeight - ( actualHeight * (distance/maxDistance) ) Thanks it's good !
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now