x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

alt text

alt text

Product Version: UE 4.20
Tags:
randomfloatbp.png (340.7 kB)
levelimage.png (976.8 kB)
more ▼

asked Nov 26 '18 at 04:33 PM in Blueprint Scripting

avatar image

sisker321
3 1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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: alt text

spawn.png (139.8 kB)
more ▼

answered Nov 26 '18 at 05:30 PM

avatar image

Tuerer
1.8k 12 7 9

avatar image sisker321 Nov 27 '18 at 04:38 PM

Ah, I see. That did the trick perfectly! Thank you!

avatar image Tuerer Nov 27 '18 at 04:51 PM

Glad I could be of help!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question