Hello!
I really need some math experts' help, I can't figure out what should I do. I am using the dxDrawMaterialLine3D function to draw light shadows on the ground, and these are attached to a vehicle. My only problem is that I don't know how should I make the light always face up, even when the vehicle is rotated and keep the rotation, so I won't experience problems like this:
So as you can see, when I'm not on an even surface, the "light" goes through the ground, that's why I would like to make the image face upwards depending on the vehicle's rotation, or at least adjust it and not make it face always up. I hope you understand what I am trying to do.
Here's what it should look like (it is on an even surface):
So, I don't really know how should I calculate these numbers to make it work with the faceTowardX, faceTowardY and faceTowardZ parameters. Could somebody help me out with the calculations?
local x, y, z = getElementPosition(matching.element)
local rx, ry, rz = getElementRotation(matching.element)
local faceX, faceY, faceZ = --?, ?, ?
dxDrawMaterialLine3D(worldX, worldY-1, fixedGroundPosition, worldX, worldY+1, fixedGroundPosition, data.renderTarget, 2, tocolor(lightColor[1],lightColor[2],lightColor[3],lightColor[4]), faceX, faceY, faceZ)
Thank you for your reply in advance!