HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Orbital Movement about a Mobile Point

01-02-2008, 05:53 PM#1
Omega-Prime
PROBLEM SOLVED: Apparently, it was simply a mathematical formality: I added one-hundred and eighty degrees to the default degree change per unit time and I successfully obtained the orbital motion I was looking for.

NEW PROBLEM: The orbiting points have, however, a nasty tendency to agglomerate with every movement of unit O, to the point that they ultimately stack onto one single orbiting point. I see several solutions to this (giving one a slowing aura, impeding simultaneous orbits on one circle, giving unit O a spell that resets their positions), but I was wondering if there is a trigger-based one that is viable and efficient. Thank you for your time!

First and foremost, thank you for taking the time to read this thread.

I have a mobile point O and two additional mobile points, A and B. Points A and B each rotate about point O in a circular path, but each point can orbit at a different radius. Point A performs an orbit of radius A' and point B performs an orbit of radius B'.

A and B should, ideally, always be separated by one-hundred and eighty degrees, regardless of the value of A' and B'.

When the unit that represents point O is created, I have a trigger that detects the direction it is currently facing and creates A and B at a polar position ninety degrees above and below that facing angle, respectively. By default, A' = B' = 256.00, so that both A and B are on the same circle but on opposite sides always.

A' and B' should be adjustable in-game.

Unit O does not move on foot; it translocates from point C to point D (it can only Blink). I have successfully triggered a simple system that simply ensures that points A and B will accompany unit O's movement and keep a symmetrical layout. In this system, they respect the values assigned to A' and B'.

However, as I have said previously, what I want to achieve is that both A and B complete a perfectly circular path about point O. This is what I have as of this moment:

Trigger:
ORBITAL MOVEMENT
Collapse Events
Time - Every 1.00 seconds of game time
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
IsPointBusy[1] Equal to False
Collapse Then - Actions
Unit - Order Point[1] to Move to ((Position of O) offset by OrbitalRadius[1] towards ((Angle from (Position of Point[1]) to (Position of O)) + 10.00) degrees)
Collapse Else - Actions
Do Nothing

When I copy the above trigger for Point[2] and OrbitalRadius[2], I achieve a "rotating line" effect about unit O; points A and B alternate places in a way that gradually makes them rotate. The line they form sweeps a circular shape, but neither point A nor point B "orbit" around unit O.

A--------O---------B
-A-------O--------B-
--A------O-------B--
------A--O--B-------
--------AOB---------
--------BOA---------
------B--O--A-------
--B------O-------A--
-B-------O--------A-
B--------O---------A

This is a quick attempt at portraying the helix-like path that they follow. B will then return to its former position, as will A; the curious thing is that the line between A and B does rotate, taking them along with it.

This brings me to my question: what trigger sequence should I use to ensure that each point will independently orbit around point O in a circle of radius A' or B'? Remember that unit O is not stationary, so I don't have a "fixed" reference frame for angles and such. What bothers me about my own trigger is that it forces the points to cross the center of this imaginary circle, and I would rather not have them do that.

I appreciate any help. Thank you.
01-04-2008, 02:57 PM#3
Tide-Arc Ephemera
Stop spamming and be useful, if you had half a brain, it lies within the fact that he does not know what method to use.

GUI and JASS may be incomparable in terms of flexibility and limitations, however what he needs is a method, not a tool. It doesn't matter how good you are at JASS or GUI, if you suck at formulas, then you'll never be able to make a fluent physics engine of any sort.
01-04-2008, 04:23 PM#4
Omega-Prime
I don't want to clutter the forum with my questions, so I'll just post this one here, as well.

The crude system that I'm trying to develop above is intended for a hero unit that I have been conceptualizing for a few days. One of his spells is a damage-over-time effect that gradually draws the target unit towards him. I have perfect understanding of how to engineer this gravitational effect, but I've been repeatedly frustrated in my attempts to complete an attractive
graphical representation of the effect.

I created a dummy unit and a dummy spell based off Life Drain. Ideally, when the hero starts the effect of this ability, four dummy units will be created: two at his base and one under each orbiting point. The two dummy units under the hero's base will be given this spell and ordered to cast it on each orbiting point. Then, the dummy unit under each orbiting point will be ordered to cast it on the target unit of the ability being cast. I will use a simple distance formula to calculate the distance between the casting hero and the target unit and to determine the rate at which the target unit should be attracted.

I would prefer that this spell was not a channeling one. This creates an immediate problem: the hero is free to Blink about while the spell is being cast, so the dummy casters must move with him and his points. Additionally, the dummy units under the orbiting points must also be constantly moving to accompany the points themselves. They cannot be moved instantly, since this interrupts the channeling of the dummy spell. To give the spell a seamless appearance, I would need to order them to recast it every 0.10 seconds after being moved, but they don't appear capable of responding to commands in such brief periods of time.

Any thoughts on how I might solve this problem?
01-04-2008, 04:42 PM#6
Strilanc
Just do the calculations for an orbit around 0,0 and add O to that.

x = cos(angle)
y = sin(angle)