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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Strange SetActorLocation behaviour

Hey everyone,

I'm getting some weird results when using SetActorLocation to reset the position of a floor tile in an endless runner project.

I have the tiles moving towards the player and when they get a certain distance behind the pawn they are moved to the rear of the tiles and reused.

The strange thing is that the first tile (and only the first tile) which is reused always has a slight offset from where it should be, leaving a small gap between the tiles. All other tiles after that are fine and snap perfectly to the tile next to it. The code is really simple, it gets the world position of the far edge of the current rear tile, and passes this into the SetActorLocation of the current tile about to be moved.

Another thing that I found interesting but can't quite see why it works differently is that if I don't reuse the tiles but simply destroy the out of bounds tile and spawn a new tile at the rear using the exact same logic to get the position, this also aligns perfectly with the tile next to it.

This makes me think the logic of getting the position is fine, but something weird is happening with SetActorLocation in this really specific situation on the first tile being moved to the rear of the queue.

Any insight here would be amazing as this is driving me crazy. I know I can just use the SpawnActor function and bypass the issue, but it seems like it should work either way...

Function to get the location of the edge of the rear tile: alt text

Function to move tile: alt text

Gap in tiles after first tile has been moved to the rear: alt text

Product Version: UE 4.20
Tags:
nextpos.png (92.5 kB)
movetile.png (84.0 kB)
crack.png (1.1 MB)
more ▼

asked Oct 17 '18 at 09:22 PM in Blueprint Scripting

avatar image

Strigifo
23 1 4

avatar image ThompsonN13 Oct 17 '18 at 09:41 PM

show us some code and possibly a video of whats occurring.

avatar image Strigifo Oct 18 '18 at 07:32 AM

I've uploaded a few images.

(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