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?
The error is probably that you add random location to already existing Coin location instead of just setting the random location itself to it. You may want to use this out-of-the-box (pun intended) method to reduce the possibility of errors in your code:
I accidentally posted this question twice. Here is the other post with an answer that solved my problem. Basically, the issue was that I attached the coin reference to the node that determined the new location, so I was adding the random coordinates to the most recent location of the coin instead of to the center of the quadrant. I unsplit the origin of the Quadrant1 actor and plugged that into the node that adds the new random x and y coordinates. Here’s a link to that other post.