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"

How to fill gap between objects by moving neighboring objects?

Lets say you have a shelf filled with books and you want to replace a large book with a thin book object (within the editor - not during gameplay). If you replace the mesh, there will be a gap in space on either side. How can I go about shifting all the books on both sides to close the gap? Likewise, how would you shift all the neighboring book objects if you replace one of them with a larger mesh, resulting in overlapping meshes. I would assume putting all the meshes into an array and use a foreach loop to move the objects (except the replaced mesh) the same value to the left or right of the object, but what would you use to determine the gap/overlapping space? Bounding box? Collision box?

alt text

Product Version: UE 4.19
fillgap.png (689.0 kB)
more ▼

asked Jun 23 '18 at 12:04 AM in Blueprint Scripting

avatar image

91 8 13 23

avatar image ThompsonN13 Jun 23 '18 at 12:51 AM

if its just placing in the scene then i would do it manually. if you really wanted to do it via blueprint then you could use book one as the anchor/ origin point and have that placed then you could use a for each for all the rest of the books and have a script that uses a line trace to determine the edge of one book and give you the location to place the next book. something like the following. of course thats just one way, theres probably a better method though.

alt text

capture.png (298.8 kB)
avatar image Haskellf Jun 23 '18 at 08:52 PM

Thanks, I will try playing around with that and see where it gets me. Yes, a BP is what I am looking for as the example I gave is very simple. Imagine if you had scores of books on a large bookshelf... like in a Library. Then a BP would be much easier to use despite it taking longer to implement during development.

avatar image enearle Jun 23 '18 at 09:31 PM

If you do this you will also have to account for the size of each book. Consider making the size of each object a multiple of a certain number of units this way you can just move them incrementally.

avatar image Nebula Games Inc Jun 23 '18 at 09:31 PM

possibly using sockets? I have never used them but they do quite well from what I hear about "attaching" components and actors to other components and actors. Attaching a weapon to a player's hand for example is done using sockets, I am sure it would be a relatively minor adjustment to get it to do the same for attaching a book to another book.

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

0 answers: sort voted first
Be the first one to answer this question
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