Home   Help Search Login Register  

Author Topic: Moving a marker around in a circle  (Read 1119 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Moving a marker around in a circle
« on: 07 May 2007, 19:54:16 »
Hey

How would I go about moving a marker around a circumfrance of a circle?

I want a dot to move around a building on a map, but I don't know how. I would assume it would need some math calculation?

Thanks for your help  :)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Moving a marker around in a circle
« Reply #1 on: 07 May 2007, 20:15:03 »
Try this:
Code: [Select]
;dotturning.sqf
_marker = _this select 0;
_center = _this select 1;
_radius = _this select 2;

while {true} do
{
   for [{_i = 0},{_i < 360},{_i = _i + 5}] do
   {
      _marker setMarkerPos [(_center select 0)+sin(_i)*_radius,(_center select 1)+cos(_i)*_radius];
      Sleep 0.5;
   };
};

Example:
Code: [Select]
["mk_mygreendot", getPos player, 100] execVM "dotturning.sqf"
EDIT:
Forgot to say ... Advanced???????

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Moving a marker around in a circle
« Reply #2 on: 08 May 2007, 02:20:03 »
Thanks. I'll try it tommorow when i'm on my PC.

Well I considered it advanced. It needs a small bit of math to work, and it's not your basic scripting so..

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Moving a marker around in a circle
« Reply #3 on: 08 May 2007, 14:57:14 »
Even though math is a complete mystery to me and thus I would consider this advanced to me, I don't think this actually fits in the advanced realm so I'm moving this here..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.