Change actor location randomly within box
I am trying to make a coin (just a black cylinder) disappear, change to a new random location within a specific area, and reappear every time I press the right mouse button. My level blueprint successfully makes the coin disappear, change location, and reappear when I click the right mouse key, but it often appears at locations outside of my quadrant 1 box that I want it to stay within. Does anyone know what I might have done wrong in my code to allow the coin to appear anywhere outside of the box that I want it to stay within?
asked Nov 26 '18 at 04:33 PM in Blueprint Scripting
You are adding the random numbers to your actor's world location, but you have to add those random numbers to the quadrant origin. Your new location mustn't depend on your previous location, but only on the quadrant's origin and bounds. Something like this:
Follow this question
Once you sign in you will be able to subscribe for any updates here