Zcraks Posted September 27, 2019 Share Posted September 27, 2019 Hi, how create a click for dxDrawMaterialLine3D ? Link to comment
Moderators IIYAMA Posted September 27, 2019 Moderators Share Posted September 27, 2019 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
Zcraks Posted September 28, 2019 Author Share Posted September 28, 2019 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 IIYAMA Posted September 28, 2019 Moderators Share Posted September 28, 2019 (edited) 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 September 28, 2019 by IIYAMA 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