Spawn new actor attached to another moving actor without gap or overlap.

Hi, trying for a while now to spawn geometry attached to one another while they move using “ProjectileMovement”.
On trigger, I spawn a new tile using the position of the last spawned objects attach point (arrow component.).
The initially spawned tiles on load are perfect. But all the ones that get spawned later on through event overlap are not precise & overlap.

Also tried spawning not on the overlap but checking if the last attach point x-axis float == to 0. Still, the same issue initial tiles are fine. But once they get spawned while moving they start to overlap. The faster the tiles move the bigger the overlap.

Finally, I tried to use the construction script.
Created an intentional gap between spawning the objects.
Sending out a ray. on hit set that world transforms as its own. Still the same issue the tiles overlap.

(It’s to spawn environment tiles that move down the X-axes. But I can’t get the tiles to align properly. Tutorials for endless/infinite runners only have examples of not moving environments.)

No hadn’t tried. But when reading it says its for use with static meshes.
When I add a socket all I see for me to do would still be getting the transform of the socket witch is an equal result as using the arrow component.

Dont really see a nother way of using the socket to algin the spawn of a actor to the previeus one.

329674-socket.png

Have you tried it with sockets?

You use node:

329689-screenshot-3.jpg

Not the same as getting the location of a component and trying to spawn at that point while it’s moving…

Tried the node. but this makes the tiles actual children of one another. & I have to remove the once that has passed the play area. I don’t really get the snapping to work either. =/

This is how I set it up.
But my guess is that attachActorToActor is not really what I need in this situation.

Yes, it will parent them, so you will need to detach again, unless you destroy them.

It will snap the pivot point of one actor to the socket on the other. Maybe your pivot is in the wrong place for that?

I can’t get this working =/
I tried to attach actor to actor. Snapping to target & Detach from actor right after.
But it will still give some overlap here & there.

After that, I tried attaching the next tile to the previous one & only set a local space offset.
I just can’t see why it won’t work as expected.

Moving the tiles with projectile movement cant be the issue right?

The actor itself is set up as shown in the image.
Cube just visual reff for the actors 0,0,0 position. the arrow component is at the same place as the socket.

I Use the projectile movement because the behavior I need is built-in. I disable the gravity & only have to set the initial & max speed.

I want to spawn certain types of tiles for as long as the player needs to clear the current objective. (Like the background of a shmup or endless runner). One of the main reasons why I want to move the environment & not the player is because I read that the growing position of spawning & player location can become an issue.

Also seems to me at least that moving the background/play area instead of the player the better long-term setup.

Wil give tick a go.Oh & thanks for sticking around =)

It’s hard to tell without seeing the whole thing, but I’d say what would certainly sort it would be for each ‘child’ tile to have a ref to the parent, and change it’s position on tick to make sure it’s always aligned with the parent.

Why are the tiles moving at all, let alone with projectile movement?

No worries, just wondering… :wink:

Ok, I was able to at least narrow my issue down.
Overall it seems that everything works.
I checked every tile that spawned one for one… I thought multiple tiles went wrong but it is actually just one.

I made a new clean project with nothing but the moving tile spawning. (always tile number 4 is off position) But all the rest will be just fine. (one actor blueprint & one game mode)

My main project has the same issue but it’s always tile number 6. (same initial amount of tiles loaded.)
Could you maybe have a look at the project that just contains the spawning tiles? (or the 2 blueprints)
I can still not see where it goes wrong. But also not sure what to try else or how to give any more written context.

Sure thing. I was going to suggest that.

Can you put the minimal project up somewhere, I’ll download and take a look…

This is what I see:

329876-tiles.gif

You might be better off with:

Doing on tick, not a good idea. You need the new tile to be on the end of the old tile ( timeline ensures this ). Also, you weren’t killing the old tiles.

With the tick method:

329878-tick.gif

Thanks a lot.

Right. Boom. The subsequent tiles were not spawning on the arrow, and various other problems.

Final solution is this. No game mode code, the tile has code:

If you want to make the spawning less obvious, just put more tiles in the level to start with. This is with 3:

329906-3-tiles.gif

Inside the TL:

AND ( sorry, forgot to say ), the arrow needs to be parented by the cube:

329908-screenshot-6.jpg

otherwise it doesn’t move when the cube does.

Did you get anywhere with it?..

Going to town with it right now. (super busy the last days =/)
Oh no the camera is just default. You actually have to pause the game & check the top view wireframe to see the overlap without the need of moving the actual tiles to double-check.

Before you could not really see the overlap with the placeholders but I assume once proper uvd & textured assets are used I would get lamina faces.

(Didn’t destroy so I can check for the overlap in the spawned actors =P)

Ok tried your setup.
But makes it actually worse in this case.
link text

link text

switching colors on every tile so you can actually see the overlap.

So I think for now I will get rid of the event tick as you suggested.
& live for now with the 1 tile that does not spawn right. For altering the type of tiles during gameplay I still think (for now) that the game mode is the better choice. (could be wrong of course XD).

I Will work on some other things for now.
Should you have any other ideas let me know. should I come up with something I will of course update this question as wel =)