samp map editor
#4

This algorithm working only for 2D orientation.
PHP код:
for(new 1Streamer_GetUpperBound(STREAMER_TYPE_OBJECT); <= ji++){
    if(
IsValidDynamicObject(i)){
        new 
Float:offset_x,Float:offset_y,Float:offset_z,
            
Float:ox,Float:oy,Float:oz,
            
Float:tx,Float:ty,Float:tz,
            
Float:dist;
    
        
GetDynamicObjectPos(i,ox,oy,oz);
        
ShiftPositionToOffset(3400.0,0.0,0.0,    0.0,0.0,0.0,    offset_x,offset_y,offset_z,    ox,oy,oz); //started position
        
        
dist VectorSize(offset_x,offset_y,offset_z);
        
        
ShiftVectorRotation(offset_x,offset_y,offset_z,    0.0,0.0,180.0,    tx,ty,tz); //new rotation here
        
        
tx *= dist;
        
ty *= dist;
        
tz *= dist;
        
        
ShiftOffsetToPosition(3200.0,0.0,0.0,    0.0,0.0,0.0,    tx,ty,tz,    ox,oy,oz); //new position
        
SetDynamicObjectPos(i,ox,oy,oz);
        
        
GetDynamicObjectRot(i,ox,oy,oz);
        
SetDynamicObjectRot(i,ox,oy,oz+180.0); //new rotation here
    
}

In this example:
old pos: 3400.0,0.0,0.0
old: rz: 0.0

new pos: 3200.0,0.0,0.0
new rz: 180.0

Libs:
3DTryg.inc
Reply


Messages In This Thread
samp map editor - by Adriac - 20.11.2017, 18:15
Re: samp map editor - by Flashhiee - 20.11.2017, 18:17
Re: samp map editor - by adri1 - 20.11.2017, 18:19
Re: samp map editor - by AbyssMorgan - 20.11.2017, 18:22
Re: samp map editor - by ad@m - 20.11.2017, 19:10

Forum Jump:


Users browsing this thread: 1 Guest(s)