26.01.2011, 02:05
(
Последний раз редактировалось randomkid88; 26.01.2011 в 02:35.
Причина: Forgot "speed" parameter on MoveObject
)
I think this is what Shadow is saying: something like this. Play with the values a little bit until you get it to work for you.
Ok since the loop will run 5 times, subtract the beginning Z position from the end Z position and thats your difference. ie: Starting Z = 200, End z = 205. 205-200 = 5, so on SetObjectPos you would do gZ+1 (5 units divided by 5 times the timer will run). Same basic principle with the angle.
pawn Код:
//Under Command or timer, whatever:
new GarageTimer;
GarageTimer = SetTimerEx("OpenGarage", 300, true, "i", objectid)
forward OpenGarage(objectid);
public OpenGarage(objectid)
{
new count, Float:gX, Float:gY, Float:gZ, Float:gXr, Float:gYr, Float:gZr;
if(count <=5) //If this is 5, each addition should be 1/5th of the distance it actually has to move. Example below
{
GetObjectPos(objectid, gX, gY, gZ);
GetObjectZAngle(objectid, gXr, gYr, gZr);
MoveObject(objectid, gX, gY, gZ+.5, SPEED); //play with speed
SetObjectRot(objectid, gX+AMT, gY+AMT, gZ+AMT); //Add a fraction of the angle to whatever axis you're rotating it on
}
else return KillTimer(GarageTimer);
}