• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Orbiting Effect Around A Building

Status
Not open for further replies.

Ardenian

A

Ardenian

That's quite easy to trigger:

X coordinate of an orbiting effect: originx + orbitrange * cos(angle)
Y coordinate of an orbiting effect: originy + orbitrange * sin(angle)

The location (originx, originy) is the origin the effect orbits around.
orbitrange is the range of the circle the effect moves around.
angle is the angle between the origin location and the current effect location.

Example:
If your effect travels around the building within one second, then do the following:
Periodically, change angle to 6*( seconds up to one second) passed and set the location of the effect
to ( originx + orbitrange * cos(angle), originy + orbitrange * sin(angle))
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
That's quite easy to trigger:

X coordinate of an orbiting effect: originx + orbitrange * cos(angle)
Y coordinate of an orbiting effect: originy + orbitrange * sin(angle)

That is a very intuitive approach though.

"I want the effect to move at 500 units per second"
Now you have a problem... kinda.
You can indeed calculate it so it will turn X radians per second calculated on the edge of the circle (Pi*d)

But what if the unit it is orbitting from is moving around?
Then it gets interesting.

There are multiple ways of orbiting, I like the one that is more of an actual missile.
 

Ardenian

A

Ardenian

Yes, I agree. It is the most basic method to create an orbiting object without considering
anything else.

However, isn't it easy to calculate the new position of the orbitting object, since you can
simply compare the old to the new position and add the difference to the orbitting object.
 
Status
Not open for further replies.
Top