Ground slope detection. - 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: Ground slope detection. (
/showthread.php?tid=600407)
Ground slope detection. -
mirou123 - 07.02.2016
I was wondering if anyone has an idea on how to detect ground slope (angle) using something like ColAndreas so I can automatically place items on the ground.
I can't think of any functions that would be useful for doing this. I know it is possible though here is a video that shows what I am talking about.
https://www.youtube.com/watch?v=UUEzxbdU_7s
Re: Ground slope detection. -
AbyssMorgan - 07.02.2016
I have a function that could retrieve rotation relative to the two points that I also know how to get. I'll try to do it.
Re: Ground slope detection. -
mirou123 - 07.02.2016
Quote:
Originally Posted by AbyssMorgan
I have a function that could retrieve rotation relative to the two points that I also know how to get. I'll try to do it.
|
That would be great thank you. I could try to get the coords of the two most distant points in the object and if the hight difference is too large (Angle to steep) it would let me know, if not it would use your function.
Re: Ground slope detection. -
AbyssMorgan - 07.02.2016
Function
PHP код:
GetGroundRotation(Float:x,Float:y,Float:size,&Float:rx,&Float:ry);
It is available in 3DTryg.inc v2.2C
value size to the length of "4 feet that check points"
https://github.com/AbyssMorgan/SA-MP...SAM/3DTryg.inc
I've tested and works
PHP код:
enum e_float {
Float:X,
Float:Y,
Float:Z,
Float:rX,
Float:rY,
Float:rZ,
Float:tX,
Float:tY,
Float:tZ,
VW,
INT,
SPEED
}
new testobj;
CMD:testg(playerid){
new F[e_float];
GetPlayerPos(playerid,F[X],F[Y],F[Z]);
GetGroundRotation(F[X],F[Y], 2.0, F[rX],F[rY]);
SetDynamicObjectPos(testobj,F[X],F[Y],F[Z]-1.0);
SetDynamicObjectRot(testobj,F[rX],F[rY],0.0);
return 1;
}
public OnFilterScriptInit(){
testobj = CreateDynamicObject(1223, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
return 1;
}
Video:
https://www.youtube.com/watch?v=SR0jZ_IxnRc
good luck
Re: Ground slope detection. -
mirou123 - 07.02.2016
Thank you for your help.