Camera ground position - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Camera ground position (
/showthread.php?tid=247058)
Camera ground position -
MP2 - 07.04.2011
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.
Re: Camera ground position -
[DJ]Boki - 07.04.2011
I find this in 10 sec.
https://sampforum.blast.hk/showthread.php?tid=34207
Looks like you didn't search
AW: Camera ground position -
Meta - 07.04.2011
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 ..
Re: Camera ground position -
[DJ]Boki - 07.04.2011
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
Re: Camera ground position -
vital2k - 07.04.2011
Maybe look in to using a plugin such as MapAndreas
https://sampforum.blast.hk/showthread.php?tid=120013
Re: Camera ground position -
MP2 - 07.04.2011
Quote:
Originally Posted by vital2k
|
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
|
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.
Re: Camera ground position -
vital2k - 07.04.2011
Urm, MapAndreas knows the Z co-ordinates of the whole map. Meaning you can detect the floor. Isn't that what you mean?