No announcement yet.

Spawn an actor when it's leaving a trigger (the same actor)

  • Filter
  • Time
  • Show
Clear All
new posts

    Spawn an actor when it's leaving a trigger (the same actor)

    Hello everyone,

    It's my first post here and I think you're gonna see me quite often !

    Actor is a Blueprintclass for the VR starter kit map.

    I'm trying to spawn an actor 'enfant1' when this actor leaver the trigger 'triggerventre'.
    It doesn't work and I don't find a tutorial I can follow.

    Can you explain me why please ?

    Nice evening,

    Welcome to the forum!

    Your execution wire seems to be disconnected.


      Thanks, it's true...

      However, it still don't work !

      I try something else : Spawn an actor when it get in a trigger.

      I want to throw a ball in a basket. When the ball go trough a trigger ( a big one, in front of the player), I want that another ball (but it is the same object) spawn at the location of the first ball.

      If think my question is : how work the SpawnActor ?

      Last edited by BrunoP Eludice; 08-06-2018, 08:09 AM.




          I made 3 actors: Ball Spawner, Ball and Target and placed the Ball Spawner and the Target in the Level Blueprint.

          The Ball Spawner has a cube (called Spawner Cube) with the following script:

          Click image for larger version

Name:	ballSpawner.PNG
Views:	45
Size:	135.6 KB
ID:	1511850

          At the Begin Play it spawns the Ball and places it on top of the Spawner Cube (you can right click the Spawn Transform pin on the Spawn Actor From Class node and split it into its components). After 2s Delay, it throws the Ball. Do note that I also created a custom event (AddNewBall) so I can reuse this bit of script later on to spawn another Ball when the Target is hit.

          The Ball actor has a sphere that has Simulate Physics enabled.

          The Target has a cube that has been squashed (scaled) to look like a platform and is called Platform. You will need to enable Simulation Generates Hit Events in the Platform for the whole thing to work.

          I also made the Ball Spawner and Target talk to each other in the Level Blueprint:

          Click image for larger version

Name:	LB.PNG
Views:	42
Size:	96.6 KB
ID:	1511851

          This binding is like an agreement between the 2 actors. Whenever Target's Platform gets hit by something, it will execute TargetHit event which, in turn, will ask the Ball Spawner to produce one more ball. Add New Ball is the Custom Event I mentioned at the beginning, the bit of reusable code.

          This creates a loop that looks like this:

          Hopefully you can extend it into something that you need.


            Thanks a lot for you're time, I learn a lot from it.

            For this case, I find a different way to do it by 'teleport' my object


              Yup, if you do not need more than one, it's always better to reuse the old one!

              Good luck with the rest.