• 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.

How to face this random angle

Status
Not open for further replies.
Level 6
Joined
Jan 8, 2009
Messages
140
The arrow is the unit that is doing the facing, the square is the point it is facing toward. How do i make it not face the point directly but instead randomly throughout a range like this for example.
f28144177f.png
 
-45 and 45 only if the cone is 90º. In the image it looks more like a ~65º cone rather than a 90º cone. So you can try -30 / 30 or -35 / 35 or whatever you want it (total angle/±2)

Yes the -45, 45 was just an example. I should have mentioned that those values can be changed according to the size of the cone.
 
Level 6
Joined
Jan 8, 2009
Messages
140
Yes the -45, 45 was just an example. I should have mentioned that those values can be changed according to the size of the cone.

yeah that's fine, all I'm looking for is the action. I can't seem to figure out where to add in the random between my values, is it point with offset? am I meant to random between my values for both the x and y offset or should it be done a different way?

  • Unit - Create 1 arch_PointerUnit[loop] for Neutral Passive at arch_PointerLoc facing (arch_ActiveArtifact[PlayerNum] offset by ((Random real number between -35.00 and 35.00), (Random real number between -35.00 and 35.00)))
 
Level 20
Joined
Jul 14, 2011
Messages
877
There is
  • Unit - Create unit for player at point facing angle
There is also a make unit face angle function, but it isnt instant.

Polar projections is basically moving a point in a direction offset by x and y and leaks, so you dont need it here.
 
There is
  • Unit - Create unit for player at point facing angle
There is also a make unit face angle function, but it isnt instant.

Polar projections is basically moving a point in a direction offset by x and y and leaks, so you dont need it here.

Did you read his above question ? Neither of these is what he is looking for

  • Unit - Create 1 arch_PointerUnit[loop] for Neutral Passive at arch_PointerLoc facing (arch_ActiveArtifact[PlayerNum] offset by ((Random real number between -35.00 and 35.00), (Random real number between -35.00 and 35.00)))

This should work for your above question.

  • Set tempPoint1 = (Position of (Triggering unit))
  • Set tempPoint2 = (Position of unitToFace)
  • Unit - Create 1 arch_PointerUnit[loop] for Neutral Passive at arch_PointerLoc facing ((Random real number between -35.00 and 35.00) + (Angle from tempPoint1 to tempPoint2 degrees))
Note the above uses the create unit facing angle. Then arithmetic to allow for the random real number on the right and the original angle to face on the right.
 
I dont see anything wrong with my answer - he asked if using PolarProjection is the right way, and I said it isnt. I didnt write the exact values because I thought it was self-explanatory.

He asked above how to face a point with a random amount of leeway. -35 to 35 degrees so it will not be facing that exact point but close to it.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
yeah that's fine, all I'm looking for is the action. I can't seem to figure out where to add in the random between my values, is it point with offset? am I meant to random between my values for both the x and y offset or should it be done a different way?

You can use this action:

  • Unit - Make (your unit) face ((Facing of (your unit)) + (Random real number between (-Range) and (Range))) over 0.00 seconds
  • That action is located at Unit action group
  • Do arithmetic to calculate the angle
  • (Facing of (your unit)) is located at Unit code group
  • (Random real number between (-Range) and (Range))) is located at Math code group
  • Over 0.00 seconds means instant

Hope this pic can help:
a.jpg

Sorry for the inconvenience. Good luck!
 
Status
Not open for further replies.
Top