Camera ground position
#1

I've been searching the forums for the last 20 minutes or so try to find if this function exists without luck. Please don't post saying 'SERCH FRST' because I have.

Is there a function that will give me the coordinates of the ground that is in the middle of a player's screen? I've got a function that detects where you're looking, and I can use MapAndreas to find the Z coordinate, but I have to set the distance from me as a variable. I don't want a set distance from me, I want it to give me the coordinates of the ground that is in the center of my screen.

If anyone knows where to find such a function, or is capable of making one please let me know.
Reply
#2

I find this in 10 sec.

https://sampforum.blast.hk/showthread.php?tid=34207

Looks like you didn't search
Reply
#3

And you didn't read ...
He wants to find the coordinates of the ground he's LOOKING AT.
pawn Код:
stock Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ)
{
    new Float:TGTDistance;

    // get distance from camera to target
    TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));

    new Float:tmpX, Float:tmpY, Float:tmpZ;

    tmpX = FrX * TGTDistance + CamX;
    tmpY = FrY * TGTDistance + CamY;
    tmpZ = FrZ * TGTDistance + CamZ;

    return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
}
I use this for my ExtFire Filterscript ..
Reply
#4

So??where are coordinates

See,you're wrong

Use/download VAE script,use some object,example camera,and put him on place you want,than copy positions,and use 'em for camera
Reply
#5

Maybe look in to using a plugin such as MapAndreas
https://sampforum.blast.hk/showthread.php?tid=120013
Reply
#6

Quote:
Originally Posted by vital2k
Посмотреть сообщение
Maybe look in to using a plugin such as MapAndreas
https://sampforum.blast.hk/showthread.php?tid=120013
Quote:
Originally Posted by Meta
Посмотреть сообщение
And you didn't read ...
He wants to find the coordinates of the ground he's LOOKING AT.
pawn Код:
stock Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ)
{
    new Float:TGTDistance;

    // get distance from camera to target
    TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));

    new Float:tmpX, Float:tmpY, Float:tmpZ;

    tmpX = FrX * TGTDistance + CamX;
    tmpY = FrY * TGTDistance + CamY;
    tmpZ = FrZ * TGTDistance + CamZ;

    return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
}
I use this for my ExtFire Filterscript ..
Quote:
Originally Posted by [DJ]Boki
Посмотреть сообщение
I find this in 10 sec.

https://sampforum.blast.hk/showthread.php?tid=34207

Looks like you didn't search
Clearly neither of you have read my post correctly. I want a function that will allow me to GET the COORDINATES. Not detect if they are looking somewhere, and not to SET their camera. I want to be able to do (for example) CreateObject(id, camx, camy, camz, ...) like in MTA. I know it wouldn't be perfect like detecting objects but I just want to know if there is a function/script out that does that.
Reply
#7

Urm, MapAndreas knows the Z co-ordinates of the whole map. Meaning you can detect the floor. Isn't that what you mean?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)