• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] relative distance

Status
Not open for further replies.
Level 7
Joined
Dec 8, 2005
Messages
319
why not periodic event and move instantly action?

well if that is the case and you have a very fast periodic event... it would still look glitchy...

and when you say same angle... do you mean that, lets use a wisp, when hero furion moves, then the wisp will be at an 90 degree angle at all times. or would you have the wisp follow furion from behind at all times? or have the units alway be looking one way... like always see the front side of the wisp?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Good job, I've actually created a solar system before (Though your looks easier). But can the "sun" be ordered to move, ad can the "planet" be controlable with the arrowkeys? (no need for the moon, though I might replace my system with that one in another game.)

Yes. With my system you can "attach" a moon to any unit you want.
You can't however use vJass...

If you want I will create a circling unit function in Jass using Handlevars.
 
Level 12
Joined
Jul 11, 2007
Messages
642
The point isn't to make it so it will constantly move around the units in a circle (i can do that.) the point is to make a unit be an aimer, and have another unit, so you can make the aimers aim and then use an ability to fire. I already found an aimer model... so I just need to make it so I can use the arrow keys to move it to a certain spot around the unit for aiming.
 
Level 12
Joined
Jul 11, 2007
Messages
642
Moves in a circle around the other unit by x...

like this text demostration:




Code:
   _____x___    
  /         \
 /           \
|      o      |

The lines are where the aimer can move, the o is where you are, and the x is where the aimer currently is. You press the right arrow key, and it moves the aimer to the right on the circle (sorry, I only drew in half of it), and you press the left arrow key, it moves the aimer to the left on the circle, but this still allows the unit to move, and still be in the center of the circle.
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
Trigonometry course:

The Pythagorean theorem:
Valid for any right triangle (a triangle with one 90 degree angle):
a^2 + b^2 = c^2
Where c is the longest side, opposite to the 90 degree angle, also called the hypotenuse. a and b are the two remaining sides. This originates from tons of fucked up stuff I'm too arsed to explain without providing good drawings.

Now, there's a relation between angles and side lengths in a right triangle. Just think about it : larger angle -> larger side. So now to introduce new functions cosine, sine and tangent:

cosine A = b/c
Where A is the angle adjacent to b, and c is the hypotenuse

sine A = a/c
Where A is the angle opposite to a, and c is the hypotenuse.

tangent A = a/b
Where A is the angle opposite to a, and b is the side adjacent to A.

Now, in this case, Wc3 is forming right triangles everywhere. Think about it: the difference in Y position of two units would be the height of the triangle, and the difference in X position of two units would be the base of the triangle. This means that you can find the resulting distance using sine and cosine to effectively project a unit with a certain distance towards a certain direction:

new x = old x + cos(angle)*distance
new y = old y + sin(angle)*distance

You can work this out to fix your problem. I'd help more but I have to go to sleep.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
so you want to make like a "model" infront of the hero that will always be infront no matter what as if he had a gun with a laser pointer on it?

Not in front. He wants it to be able to circle around the hero using the left and right keys.

Supermj, if you didn't get it alone yet, just use what HINDY gave you, move the "target" model to that position every 0.05 or so, and when a player clicks on the left/right keys, reduce/raise the angle's value.
 
Level 2
Joined
Apr 14, 2008
Messages
17
Maybe try making regions around the Hero in a circle. Each time the hero moves away from the regions, make sure that the units following distance is kept at the same rate, else he will just keep circling at the regions
 
Status
Not open for further replies.
Top