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?
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.
xXMADEXx Posted March 13, 2015 Posted March 13, 2015 I used the calculations from this script. https://community.multitheftauto.com/in ... ls&id=3090
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) )
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
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