Emilio_M Posted March 12, 2015 Share 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 ! Link to comment
Castillo Posted March 12, 2015 Share 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? Link to comment
Emilio_M Posted March 12, 2015 Author Share Posted March 12, 2015 Yes. Draw with world position with different scale due to the distance with the world point. Link to comment
JR10 Posted March 12, 2015 Share Posted March 12, 2015 Use getDistanceBetweenPoints2D/3D and then do some calculations. Link to comment
Emilio_M Posted March 12, 2015 Author Share Posted March 12, 2015 Yes but i want the calculations Link to comment
xXMADEXx Posted March 13, 2015 Share Posted March 13, 2015 I used the calculations from this script. https://community.multitheftauto.com/in ... ls&id=3090 Link to comment
Emilio_M Posted March 13, 2015 Author Share 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. Link to comment
Emilio_M Posted March 13, 2015 Author Share 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. Link to comment
Addlibs Posted March 13, 2015 Share Posted March 13, 2015 width = actualWidth - ( actualWidth * (distance/maxDistance) ) height = actualHeight - ( actualHeight * (distance/maxDistance) ) Link to comment
darhal Posted March 13, 2015 Share 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 Link to comment
Emilio_M Posted March 13, 2015 Author Share Posted March 13, 2015 width = actualWidth - ( actualWidth * (distance/maxDistance) ) height = actualHeight - ( actualHeight * (distance/maxDistance) ) Thanks it's good ! Link to comment
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