what I want was to create an object that would appear above and when the object fell, the explosion would be activated.
And the problem is that the object appears above where I am, and I want it further away and where I am looking, and the explosion appears behind me and I want it to appear where I look.
the matrix did not work
How to use: getPedTargetEnd, getScreenFromWorldPosition and getWorldFromScreenPosition
that's what I need so that the explosion and the object appear where I look and away from me, but do I know how to use.
Here I leave my code
objs = {}
addCommandHandler ( "explosion",
function ( thePlayer )
local x, y, z = getElementPosition ( thePlayer )
local rx, ry, rz = getElementRotation ( thePlayer )
local origX, origY, origZ = getElementPosition ( thePlayer )
local mat = Matrix.create ( x, y, z+20, rx, ry, rz, origX - 30,origY+30,origZ)
local forward = ( Matrix.getForward ( mat ) * 4)
local pos = ( Matrix.getPosition ( mat ) + forward )
setTimer (createExplosion, 2000, 1,x+10, y, z, 11)
objs[thePlayer] = createObject(751, pos)
local newZ = origZ +0
moveObject( objs[thePlayer], 2000, origX, origY, origZ)
end
)
please help me, the matrix will not work