# Drawing in fabulous world !

## Recommended Posts

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 ) ?

Thanks to all !

Yes. Draw with world position with different scale due to the distance with the world point.

Yes but i want the calculations I used the calculations from this script.

https://community.multitheftauto.com/in ... ls&id=3090

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.

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.

```width = actualWidth - ( actualWidth * (distance/maxDistance) )
height = actualHeight - ( actualHeight * (distance/maxDistance) )
```

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

```width = actualWidth - ( actualWidth * (distance/maxDistance) )
height = actualHeight - ( actualHeight * (distance/maxDistance) )
```

Thanks it's good !

## Create an account

Register a new account