GetVehicleModelInfo
#1

Hi everyone , i'm trying to "input" Angle in "X-Y" but , no result becaue i never made something like this. I want to take the perfect possition , can someone help me please?

Код:
GetVehiclePos(GetPlayerVehicleID(playerid),p[0],p[1],p[2]);
	    GetVehicleZAngle(GetPlayerVehicleID(playerid),p[3]);
	    GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_PETROLCAP, X, Y, Z);
	    SetPlayerCheckpoint(playerid,p[0]+X,p[1]+Y,p[2]+Z,3.0);

		p[0] += (floatsin(-p[3], degrees));
		p[1] += (floatcos(-p[3], degrees));
	    
	    testpick = CreatePickup(1318,23,p[0]+X,p[1]+Y,p[2]+Z,-1);
I want to get the perfect possition of my "petrolcap" even if i change my car angle.
Reply
#2

Код:
new 
    Float: x, Float: y, Float: z,
    Float: a, Float: vX, Float: vY, Float: vZ,
    vehicleid = GetPlayerVehicleID(playerid),

    Float: fDistance = 1.0;

GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
a += 90;

GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_PETROLCAP, vX, vY, vZ);

x += (fDistance * floatsin(a, degrees));
y += (fDistance * floatcos(a, degrees));

SetPlayerCheckpoint(playerid, x + vX, y + vY, z + vZ, 3.0);
CreatePickup(1318, 23, x + vX, y + vY, z + vZ, -1);
Change distance to change how much you want the pickup and checkpoint to be in front of the petrol cap.
Use 0.0 if you want the exact pos, positive numbers (> 0.0) if you want it in front of it, negative if behind (< 0.0)
Reply
#3

To actually get it right you need to use the rotation quats function.
Reply
#4

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Код:
new 
    Float: x, Float: y, Float: z,
    Float: a, Float: vX, Float: vY, Float: vZ,
    vehicleid = GetPlayerVehicleID(playerid),

    Float: fDistance = 1.0;

GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
a += 90;

GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_PETROLCAP, vX, vY, vZ);

x += (fDistance * floatsin(a, degrees));
y += (fDistance * floatcos(a, degrees));

SetPlayerCheckpoint(playerid, x + vX, y + vY, z + vZ, 3.0);
CreatePickup(1318, 23, x + vX, y + vY, z + vZ, -1);
Change distance to change how much you want the pickup and checkpoint to be in front of the petrol cap.
Use 0.0 if you want the exact pos, positive numbers (> 0.0) if you want it in front of it, negative if behind (< 0.0)
Same , don't get the right possition.
Reply
#5

//edit:

http://i.imgur.com/nxqBRUQ.png

PHP код:
CMD:petrolcap(playerid){ 
    new 
vid GetPlayerVehicleID(playerid), 
        
Float:xFloat:yFloat:zFloat:rxFloat:rz
        
Float:vxFloat:vyFloat:vzFloat:angle;
     
    
GetVehiclePos(vid,vx,vy,vz); 
    
GetVehicleZAngle(vid,angle); 
    
GetVehicleModelInfo(GetVehicleModel(vid),VEHICLE_MODEL_INFO_PETROLCAP,x,y,z); 
    if(
GetRotationFor2Point3D(0.0,0.0,0.0,x,y,z,rx,rz)){ 
        new 
Float:dist VectorSize(x,y,z) + 1.0
        
GetPointInFront3D(vx,vy,vz,rx,CompRotationFloat(angle+rz),dist,x,y,z);
        
SetPlayerCheckpoint(playerid,x,y,z,3.0); 
    } else { 
        
//doesn't have petrolcap (0.0,0.0,0.0) 
    

    return 
1

3DTryg:
https://sampforum.blast.hk/showthread.php?tid=591010
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)