21.06.2014, 23:42
I never stated it but ScreenToWorld actully returns a vector (returning a position would need a distance parameter)
Since I use the front vector as base, it also starts at the camera pos
Since I use the front vector as base, it also starts at the camera pos
pawn Код:
// I think NewX and NewY are normal textdraw coordinates ?
// Than they need to be float and we just insert them directly in StW
public OnCursorPositionChange(Float: NewX, Float: NewY)
{
if(var == 1)
{
const playerid = 0;
new pos[6];
GetPlayerCameraPos(playerid, p[0], p[1], p[2]);
ScreenToWorld(playerid, NewX, NewY, p[3], p[4], p[5]);
const Float: distance = 25.0;
p[0] += p[3] * distance;
p[1] += p[4] * distance;
p[2] += p[5] * distance;
SetObjectPos(obj, p[0], p[1], p[2]);
printf("%f, %f, %f", p[0], p[1], p[2]);
}
}