Any way to get the slope of the terrain? - 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)
+--- Thread: Any way to get the slope of the terrain? (
/showthread.php?tid=645310)
Any way to get the slope of the terrain? -
Paulthaz - 24.11.2017
Hello guys, Is there any way to get the slope of the terrain?
@Sorry for my bad English!
Re: Any way to get the slope of the terrain? -
Pottus - 24.11.2017
https://sampforum.blast.hk/showthread.php?tid=586068
Код:
CA_RayCastLineAngle(Float:StartX, Float:StartY, Float:StartZ, Float:EndX, Float:EndY, Float:EndZ, &Float:x, &Float:y, &Float:z, &Float:rx, &Float:ry, &Float:rz)
It only really works for terrain well, I am not sure how to get the correct rotation to translate an objects position correctly so it stands on the face of a surface correctly.
The mangle module in Texture Studio uses this function.
https://github.com/Pottus/Texture-St...dio/mangle.pwn
Код:
CA_RayCastLineAngle(x, y, 1200.0, x, y, -100.0, z, z, z, GroupSlopeRX[playerid], GroupSlopeRY[playerid], z);
GroupRotate(playerid, GroupSlopeRX[playerid], GroupSlopeRY[playerid], 0.0);
This finds the slope then rotates a loaded prefab to the slope of the surface the player is standing on.