nikitafloy Posted June 17, 2014 Posted June 17, 2014 How to create 3d text on the wall? Or relatively Player - https://community.multitheftauto.com/in ... ls&id=8289
Moderators IIYAMA Posted June 17, 2014 Moderators Posted June 17, 2014 https://wiki.multitheftauto.com/wiki/DxDrawText [b]FROM VERSION 1.3.5 r6054 ONWARDS[/b] fRotation: Rotation fRotationCenterX: Rotation Origin X fRotationCenterY: Rotation Origin Y
nikitafloy Posted June 17, 2014 Author Posted June 17, 2014 https://wiki.multitheftauto.com/wiki/DxDrawText [b]FROM VERSION 1.3.5 r6054 ONWARDS[/b] fRotation: Rotation fRotationCenterX: Rotation Origin X fRotationCenterY: Rotation Origin Y Dont work: dxDrawText(text, x, y, 746, 235, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false, 0, 50, 50) dxDrawText(text, x, y, 745, 234, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false, 0, 50, 50)
Moderators IIYAMA Posted June 17, 2014 Moderators Posted June 17, 2014 https://wiki.multitheftauto.com/wiki/OnClientRender and learn lua... or you come nowhere. http://www.lua.org/manual/5.2/
nikitafloy Posted June 17, 2014 Author Posted June 17, 2014 https://wiki.multitheftauto.com/wiki/OnClientRenderand learn lua... or you come nowhere. http://www.lua.org/manual/5.2/ u dont understand... addEventHandler("onClientRender", root, function() local x,y,z = getElementPosition( skinEx ) dxDrawText(text, x, y, 746, 235, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, true, 0, 100, 100) dxDrawText(text, x, y, 745, 234, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, true, 0, 100, 100) dxDrawText("<- " .. text .. " ->", 417, 538, 836, 567, tocolor(0, 0, 0, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) end )
Moderators IIYAMA Posted June 17, 2014 Moderators Posted June 17, 2014 ah you are further then I thought, GOOD Check this out man: https://wiki.multitheftauto.com/wiki/Ge ... ldPosition World positions aren't the same as the screen resolution, this function will convert that. This function can also return false(when the x,y,z aren't on screen), keep that in mind. Check the returned values.
nikitafloy Posted June 17, 2014 Author Posted June 17, 2014 ah you are further then I thought, GOOD Check this out man: https://wiki.multitheftauto.com/wiki/Ge ... ldPosition World positions aren't the same as the screen resolution, this function will convert that. This function can also return false(when the x,y,z aren't on screen), keep that in mind. Check the returned values. Thanx. This attach relative to a point, but is not rotated so far. function selectorON() local x, y = guiGetScreenSize() local xg, yg = getScreenFromWorldPosition ( 218.19999694824, -98.5, 1005.299987793 ) if ( xg and yg ) then dxDrawText("Test", xg, yg, 746, 235, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, true, 0, 50, 50) dxDrawText("Test", xg, yg, 745, 234, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, true, 0, 50, 50) end end
.:HyPeX:. Posted June 17, 2014 Posted June 17, 2014 You got the rotations wrong thought. This gave me a really bad time while working out my horizonal menu... Look at this, it will make a 90° rotation to the right. (The three rotations in the table) {270, x * 0.05 + (x*0.2), y*0.85} Explanation: 270° clockwise rotation. x * 0.25 Right > Left screen position rotation point. y * 0.85 Top > Down screen position rotation point. By the way, use dxDrawText3D instead, this only rotates on a 2D way. PD: This is how it goes for a dxDrawText every 0.2 * X in the screen. (Part of long table) local x,y = guiGetScreenSize() TextNow = { Text1 = {"Achivements", 0.21, 0.8, 0.1,0.1,270, x * 0.05 + (x*0.2 ), y*0.85,255}, Text2 = {"Rankings", 0.41 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.4 ), y*0.85,255}, Text3 = {"Tuning",0.61 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.6 ), y*0.85,255}, Text4 = {"Settings", 0.81 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.8 ), y*0.85,255}, }, --- Drawing i=1 local a = "Text"..i dxDrawText(Dashboard.Positions.TextNow[a][1] , Dashboard.Positions.TextNow[a][2] * x, Dashboard.Positions.TextNow[a][3] * y, Dashboard.Positions.TextNow[a][4] * x, Dashboard.Positions.TextNow[a][5] * y, tocolor(255,255,255,alpha),3,"clear","left", "top", true, false,true, false, true, Dashboard.Positions.TextNow[a][6], Dashboard.Positions.TextNow[a][7], Dashboard.Positions.TextNow[a][8]) EDIT: Did a small sketch to illustrate how it works:
nikitafloy Posted June 18, 2014 Author Posted June 18, 2014 You got the rotations wrong thought. This gave me a really bad time while working out my horizonal menu...Look at this, it will make a 90° rotation to the right. (The three rotations in the table) {270, x * 0.05 + (x*0.2), y*0.85} Explanation: 270° clockwise rotation. x * 0.25 Right > Left screen position rotation point. y * 0.85 Top > Down screen position rotation point. By the way, use dxDrawText3D instead, this only rotates on a 2D way. PD: This is how it goes for a dxDrawText every 0.2 * X in the screen. (Part of long table) local x,y = guiGetScreenSize() TextNow = { Text1 = {"Achivements", 0.21, 0.8, 0.1,0.1,270, x * 0.05 + (x*0.2 ), y*0.85,255}, Text2 = {"Rankings", 0.41 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.4 ), y*0.85,255}, Text3 = {"Tuning",0.61 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.6 ), y*0.85,255}, Text4 = {"Settings", 0.81 , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.8 ), y*0.85,255}, }, --- Drawing i=1 local a = "Text"..i dxDrawText(Dashboard.Positions.TextNow[a][1] , Dashboard.Positions.TextNow[a][2] * x, Dashboard.Positions.TextNow[a][3] * y, Dashboard.Positions.TextNow[a][4] * x, Dashboard.Positions.TextNow[a][5] * y, tocolor(255,255,255,alpha),3,"clear","left", "top", true, false,true, false, true, Dashboard.Positions.TextNow[a][6], Dashboard.Positions.TextNow[a][7], Dashboard.Positions.TextNow[a][8]) EDIT: Did a small sketch to illustrate how it works: Thanks for your reply. Unfortunately, it did not affect my problem. The text also only rotates around its axis. And I could not test the performance of your script, it does not work for me, sorry. I noticed that on the forum wrote that the text rotation is not working.
.:HyPeX:. Posted June 18, 2014 Posted June 18, 2014 It does work, if you want i can PM you with my menu setup. (Full working with the texts) It just wont work for doing a 3D thing. (Since its 2D rotation)
zocken212 Posted June 19, 2014 Posted June 19, 2014 If I understood you correctly: Create a new texture (or render target) with https://wiki.multitheftauto.com/wiki/Dx ... nderTarget, then draw the text to the render target and at the end draw the render target with https://wiki.multitheftauto.com/wiki/Dx ... tionLine3D at your desired position
nikitafloy Posted June 22, 2014 Author Posted June 22, 2014 If I understood you correctly:Create a new texture (or render target) with https://wiki.multitheftauto.com/wiki/Dx ... nderTarget, then draw the text to the render target and at the end draw the render target with https://wiki.multitheftauto.com/wiki/Dx ... tionLine3D at your desired position Thanks for the quick reply. I 'conjured' and got the expected result. Thank you.
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