FuriouZ Posted January 25, 2014 Share Posted January 25, 2014 Hello, i have some questions How i can attach image under the vehicle like this ? (THIS IS SHADER) But is it possible to create same thing via dxDrawMaterialLine3D ? Here is code: local Sheild = dxCreateTexture("neons/neon_sheild.png") addEventHandler("onClientRender", root, function() -- x,y,z, targetx,targety,targetz,texture,width,color dxDrawMaterialLine3D (0,0,2,0,0,15,Sheild, 10, tocolor(255,255,255,255)) end) I tryed, but i don't understang how i can add it under the car with correct position Link to comment
xScatta Posted January 25, 2014 Share Posted January 25, 2014 getElementPosition -- get position of car getScreenFromWorldPosition -- get screen position from position of car https://wiki.multitheftauto.com/wiki/onClientRender -- render the image dxDrawImage -- draw the image using the getScreenFromWorldPosition with car position and rotation to make it flat Link to comment
50p Posted January 25, 2014 Share Posted January 25, 2014 If it works fine with shader then why doing it with dxDrawMaterialLine3D? Link to comment
DiSaMe Posted January 25, 2014 Share Posted January 25, 2014 getElementMatrix That's how I made the tags sprayable on vehicles in my Drawtag script. Link to comment
FuriouZ Posted January 25, 2014 Author Share Posted January 25, 2014 getElementPosition -- get position of car getScreenFromWorldPosition -- get screen position from position of car https://wiki.multitheftauto.com/wiki/onClientRender -- render the image dxDrawImage -- draw the image using the getScreenFromWorldPosition with car position and rotation to make it flat Almost works, but i don't understand how to put it under the car and there's one more problem with camera position Cam position #1 Cam position #2 local Sheild = dxCreateTexture("neons/neon_sheild.png") local gVehicle = getPedOccupiedVehicle(localPlayer) function drawImage() local x,y,z = getElementPosition(gVehicle) dxDrawMaterialLine3D(x,y,z -1,x,y,5,Sheild, 5) end addEventHandler("onClientRender", root, drawImage) Link to comment
xScatta Posted January 25, 2014 Share Posted January 25, 2014 @theVenom dxDrawImage ( float posX, float posY, float width, float height, mixed image [, float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, int color = tocolor(255,255,255), bool postGUI = false ] ) float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0 Just use the rotation. Link to comment
FuriouZ Posted January 25, 2014 Author Share Posted January 25, 2014 Still don't get it .. Link to comment
Ren_712 Posted January 25, 2014 Share Posted January 25, 2014 bool dxDrawMaterialLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, element material, int width, [, int color = white, float faceTowardX, float faceTowardY, float faceTowardZ ] ) First and second point in space (x,y,z) should be bottom back and bottom front of the vehicle. Element material is the texture then width, color white, fade toward xyz would be 0,0,-1 Link to comment
DiSaMe Posted January 25, 2014 Share Posted January 25, 2014 ... getElementMatrix You can't keep the image at the same position from the vehicle's point of view just by using position. Obviously, rotation makes difference. And matrix is the most straightforward and intuitive way to represent the rotation. 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