Jump to content

dxDrawMaterialLine3D click


Zcraks

Recommended Posts

  • Moderators
1 hour ago, Zcraks said:

Hi, how create a click for dxDrawMaterialLine3D ?

The 2D way.

 

First translate the 3D start and end point to 2D. With this function:

https://wiki.multitheftauto.com/wiki/GetScreenFromWorldPosition

You have now a 2D line instead of a 3D.

 

Next

Get the distance between the 2D line and point(your cursor) with:

https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPointAndSegment2D

 

 

 

Link to comment
17 hours ago, IIYAMA said:

2D способ.

 

Сначала переведите начальную и конечную точку 3D в 2D. С этой функцией:

https://wiki.multitheftauto.com/wiki/GetScreenFromWorldPosition

Теперь у вас есть 2D линия вместо 3D.

 

следующий

Получите расстояние между 2D-линией и точкой (вашим курсором) с помощью:

https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPointAndSegment2D

 

 

 

x1, y1 = getScreenFromWorldPosition(v[1]+0.5, v[2], v[3]+1)
x2, y2 = getScreenFromWorldPosition(v[1]+0.5, v[2], v[3])	

...

getDistanceBetweenPointAndSegment2D(clickedX, clickedY, x1, y1, x2, y2)


attempt to call global "getDistanceBetweenPointAndSegment2D" (a nil value)

Link to comment
  • Moderators
9 minutes ago, Zcraks said:

x1, y1 = getScreenFromWorldPosition(v[1]+0.5, v[2], v[3]+1)
x2, y2 = getScreenFromWorldPosition(v[1]+0.5, v[2], v[3])	

...

getDistanceBetweenPointAndSegment2D(clickedX, clickedY, x1, y1, x2, y2)


attempt to call global "getDistanceBetweenPointAndSegment2D" (a nil value)

It is not a MTA function.

Get it from here:

https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPointAndSegment2D

Edited by IIYAMA
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...