OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Deadfast on 12 Feb 2009, 21:43:53
-
Hello fellow scripters,
I'm struggling with a little problem here.
Basically what I need is to have an object (red) rotating around another, static one (yellow).
(http://i182.photobucket.com/albums/x279/deadfastcz/junk/rotateobj.gif)
Unfortunately for me my math sucks too much to be able to figure this on my own :confused:.
Thanks in advance,
Deadfast
-
_yellow = _this select 0;
_red = _this select 1;
_center = getPos _yellow;
_radious = 20; // Radious, distance between red and yellow
_angspd = 5; // Angle ingrements in degrees per each loop
_ang = 0; // Initial angle
while {true} do
{
_red setPos [(_center select 0)+sin(_ang)*_radious,(_center select 1)+cos(_ang)*_radious, 0];
_ang = _ang + _angspd;
if (_ang > 360) then
{
_ang = _ang - 360;
};
sleep 0.1;
};
-
Thanks a lot, works just great ;)