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"

EndOverlap only fires once

Alright, I'm not English so I'll try my best to explain: I'm currently working on a simple climbing game. Its like an infinite accelerating sidescroller, except that it moves upwards. The player has to jump on spawning platforms to prevent falling down below the screen and losing the game. Super Smash Bros have a few levels like this. The game will keep running until the player dies. This means that the building the player is climbing has to build itself.

I made a blueprint with a mesh (the cubical "room" you can see in the gif), which essentially spawns another actor of the same class a specified amount above itself whenever it hits a trigger parented to the moving camera. Basically, when the wall has reached a certain point on the screen, it will spawn a new one above itself to continue the cycle. Let me know if its hard to understand.

I have attached a gif to make it easier to see, but the file size required is way too small to be practical, so this will have to make do.

alt text

Here is the problem: As you can see, a new wall is spawned the first time, but not the second time. The wall is actually ignoring the trigger completely. Keep in mind that it is the camera, floor, and trigger moving upwards, and not the walls moving downwards. The small cubes are present to visualize the movement.

Tl;dr, the self building wall ignores an overlapping trigger, and therefore doesn't spawn a new wall above itself, which breaks the cycle. I'll accept both solutions for the overlap ignore or another method for making the wall build itself alongside the camera.

Here is the blueprint for the selfbuilding wall. The trigger is a box trigger placed in the world, and attached to the camera at beginplay. I'm grateful for any help. alt text

Product Version: UE 4.21
Tags:
wallspawn6.gif (4.1 MB)
wallspawn7.png (259.1 kB)
more ▼

asked Mar 28 '19 at 09:31 PM in Blueprint Scripting

avatar image

CorbisHETB
30 5 5 9

avatar image Nebula Games Inc Mar 28 '19 at 10:50 PM

Who owns the trigger? Who is overlapping who? It is kind of hard to tell what the exact setup here is. Need screen shots of the components for both the wall and the moving floor including where the overlap is. Also, using a "trigger" class is odd, I would think you just need a box collision on the wall/floor depending who does the overlaps and use that to determine when things have "ended" overlapping and need to spawn again. Perhaps your trigger reference is only functional for the first instance. Many things, can't tell with the limited info.

avatar image CorbisHETB Mar 28 '19 at 11:16 PM

The trigger is just a trigger box dragged into the world from the Modes Panel to the left. The overlapping actor is a blueprint with a wall mesh. These two are overlapping. The box trigger is attached to the camera.

How is this? I think I should mention that the camera moves by the level blueprint, not its own actor.

alt text

I added a color to the wall actor to help distinguish it from everything else.

I don't know why I picked the trigger, it was just the first and best thing I found. I didn't know there was much of a difference to be honest. I'll try with collisions instead. Anything else you would like to see/know?

wallspawn8.png (1.6 MB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

i think your making this a bit too complex for your use case. below i made a simple example of how you could handle your walls in a manner similar to a endless runner (since thats basically what your making). so at the most simple you need an endless stream of floors, this can be done two ways while actually moving the platform as you like. you could spawn new floors as they come on screen and destroy the old as they leave (many ways to do this). or you could just move floors and cycle them, so when one moves off screen you move it to above the screen and reuse it (better performance). ill be looking at the first method since its easy. for this method we will want to spawn a new room once something begins overlapping the current room, so if the platform is overlapping the room then we want to spawn the next one. for this we will need a collision volume (box), you will need your wall mesh, and to be used later you will want a scene component (i added a arrow to show placement). the actual script will be much like yours, on begin overlap spawn wall. in this case we add a little extra check to make sure the overlap isnt another wall to ensure it doesnt spawn more walls than needed. we also use a do once for the same reason, we dont want to spawn a wall bp for a overlap of the character and the platform. another little change was the use of the scene component to determine the new spawn location, this makes things much easier, versatile, and eliminates the need for the math your using. the last bit i included was a way to destroy the wall on end overlap, basically when the wall stops overlapping the player character we set its life span to 1 second meaning it will be destroyed in that amount of time. you may want to use a different method to destroy your wall sections since it seems like your looking to have exponential acceleration, you may need a variable lifespan or a different method.

personally i would incorporate the destroy into the platform and have that as its own bp actor. your platform could incorporate the camera as well then it would be easy to make a very modular setup to have multiple levels.

alt text alt text

capture.png (426.2 kB)
capture1.png (205.6 kB)
more ▼

answered Mar 29 '19 at 12:52 AM

avatar image

ThompsonN13
10.1k 33 9 23

avatar image CorbisHETB Mar 29 '19 at 02:56 PM

Hey, thanks a lot for the help. I've tried to do the same as you, but had some complications. here's my blueprints.

EDIT: I don't know where that last picture went, but you should be able to download it or open it in a new tab by the attached images below. alt text

alt text

I haven't gotten around to trying it out properly because the game keeps telling me I run into an infinite loop. It then directs me to this macro from the DoOnce node. It directed me to the BeginOverlap node as well one time. Don't really understand what's happening.

Also, I need to tell the game to use the camera in the platform blueprint, but the component is not a valid variable for Set View Target With Blend. Any idea what I could do with this? Also, the way the platform moves up at the moment is a little clunky. It works, but I'm wondering if you have any better ways to move it?

I'm also wondering if i could have a box collision trigger in the platform blueprint, about a wall's length below the platform. This could take care of destroying the wall actor.

And lastly, how difficult would it be to use the wall loop instead of destroying them? The game is supposed to be easy to run on as many computers as possible, and performance is fairly important.

utklipp.png (217.3 kB)
utklipp2.png (117.5 kB)
utklipp3.png (241.4 kB)
avatar image ThompsonN13 Mar 29 '19 at 11:17 PM

k i just looked into it and i made a simple mistake with the not equal node, i was thinking it was a class reference for some reason but thats actually a object reference. so you could just do a get class node (like you had originally) and work with class references or you could just use a cast instead of the != and branch, basically cast to walls class and if fail then do once.

whilst testing this i actually came upon another issue where the do once was actually letting two executions through when i had a setup testing for anything not a wall as shown above. what seems to be the best method to solve your current issue and the one i stumbled upon would be to create a bp actor for the platform, use a get player character and then use a equal node, or simply cast to character

alt text.

capture.png (152.7 kB)
avatar image CorbisHETB Mar 30 '19 at 02:20 AM

Aaaaand it works! I'm using the object class method, and no problems so far. I created a box trigger and attached it to the platform blueprint. When a wall ends its overlap with it, it destroys itself. Basically, walls are building and destroying itself when supposed to. Thanks a lot for the help, I learned a lot!

(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