[Include] Screen to World vice versa
#25

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

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]);
    }
}
Reply


Messages In This Thread
Screen to World vice versa - by Nero_3D - 09.12.2013, 21:43
Re: Screen to World vice versa - by Patrick - 09.12.2013, 21:50
Re: Screen to World vice versa - by Vinnyy - 10.12.2013, 01:54
Re: Screen to World vice versa - by Kar - 10.12.2013, 02:07
Re: Screen to World vice versa - by Sublime - 10.12.2013, 02:20
Re: Screen to World vice versa - by ViruZz - 10.12.2013, 04:25
Re: Screen to World vice versa - by kristo - 10.12.2013, 10:56
Re: Screen to World vice versa - by iJumbo - 10.12.2013, 11:05
Re: Screen to World vice versa - by Slice - 10.12.2013, 11:12
Re: Screen to World vice versa - by Vinnyy - 10.12.2013, 13:30
Re: Screen to World vice versa - by Kyle - 10.12.2013, 15:01
Re: Screen to World vice versa - by Vinnyy - 11.12.2013, 02:08
Re: Screen to World vice versa - by SkittlesAreFalling - 11.12.2013, 02:36
Re: Screen to World vice versa - by Kaperstone - 11.12.2013, 03:01
Re: Screen to World vice versa - by iZN - 11.12.2013, 06:17
Re: Screen to World vice versa - by Emmet_ - 11.12.2013, 11:22
AW: Re: Screen to World vice versa - by Nero_3D - 11.12.2013, 17:11
Re: AW: Re: Screen to World vice versa - by Vinnyy - 12.12.2013, 03:15
AW: Screen to World vice versa - by LeBoyce - 12.12.2013, 15:37
Respuesta: Screen to World vice versa - by adri1 - 14.06.2014, 20:34
AW: Respuesta: Screen to World vice versa - by Nero_3D - 14.06.2014, 21:10
Re: Screen to World vice versa - by VladimirMark - 14.06.2014, 21:31
Re: Screen to World vice versa - by MacT - 18.06.2014, 20:45
Respuesta: Screen to World vice versa - by adri1 - 21.06.2014, 21:10
AW: Screen to World vice versa - by Nero_3D - 21.06.2014, 23:42
Respuesta: Screen to World vice versa - by adri1 - 22.06.2014, 15:14
AW: Respuesta: Screen to World vice versa - by Nero_3D - 22.06.2014, 17:19
Respuesta: Screen to World vice versa - by adri1 - 22.06.2014, 17:23
Re: Screen to World vice versa - by iRaiDeN - 22.06.2014, 19:33
AW: Respuesta: Screen to World vice versa - by Nero_3D - 23.06.2014, 16:07
Re: Screen to World vice versa - by codectile - 04.06.2015, 09:38

Forum Jump:


Users browsing this thread: 3 Guest(s)