On MoveObject so it can rotate it also? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: On MoveObject so it can rotate it also? (
/showthread.php?tid=216612)
On MoveObject so it can rotate it also? -
Zack9764 - 26.01.2011
When it's moving I want it to rotate up basically. I scripted a garage door. And I want it to open like one.
If you don't know what I'm talking about here's my visual examples:
The object by default:
http://wescottridgecondos.files.word...arage-door.jpg
Start to move like this:
http://img.archiexpo.com/images_ae/p...ors-153634.jpg
It should finish, pointing out but on a flat side.
Re: On MoveObject so it can rotate it also? -
marinov - 26.01.2011
Show current code so ppl can reply
Re: On MoveObject so it can rotate it also? -
Shadow™ - 26.01.2011
Uh, I'd try creating a timer which adds a small height difference and rotates it ry and put it on repeat, I'll try whip up a code now but no guarantee
Re: On MoveObject so it can rotate it also? -
Zack9764 - 26.01.2011
Quote:
Originally Posted by marinov
Show current code so ppl can reply
|
You obviously don't know what your talking about...
Re: On MoveObject so it can rotate it also? -
randomkid88 - 26.01.2011
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.
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);
}
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.
Re: On MoveObject so it can rotate it also? -
marinov - 26.01.2011
Quote:
Originally Posted by Zack9764
You obviously don't know what your talking about...
|
Fuck, another fagget like you come here to ask for help and talk to the other like that, fuck off
You obviously didn't even try to make it, thats why u dont have a code to show, learn, and try, last case ask !