Ground slope detection.
#1

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
Reply
#2

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.
Reply
#3

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.
Reply
#4

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.0F[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(12230.00.00.00.00.00.0);
    return 
1;    

Video:
https://www.youtube.com/watch?v=SR0jZ_IxnRc

good luck
Reply
#5

Thank you for your help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)