Announcement

Collapse
No announcement yet.

if x coordinate of actor is less than my character, destroy it?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    if x coordinate of actor is less than my character, destroy it?

    Hi, i'm making an endless runner game right now and when I run past the obstacles I want them to be destroyed so they don't effect the games performance, at the moment the tiles delete but the obstacles stay in position forever which will eventually crash the app. My character runs in the x axis so I was wondering what blueprint I would use for this:
    if the x coordinate of the obstacle is less than the x coordinate of the playable character, delete the obstacle?

    #2
    Place a volume behind the character, destroy everything that touches it, like so:

    https://answers.unrealengine.com/que...5941/view.html

    You can, of course, compare coordinates but that would require you to keep track of many objects and their whereabouts. Try the solution I suggested, it should work well for this.

    edit: the link might be a tad misleading. Essentially, have the volume behind the player destroy actors / components that either begin or end overlapping with it.
    Last edited by Everynone; 06-13-2019, 12:59 PM.

    Comment


      #3
      Thanks, i tried something like this before thinking of the x axis idea, I couldn't get it so when the objects hit the box, the game wouldn't end as the box was part of my characters blueprint. Do you know what I would do to make it so the box collides with the objects without causing my character to die?

      Comment


        #4
        Either have the box far enough behind your character so it doesn't touch them (and so nothing visible on screen gets deleted), or give the character a tag (Player?) and just check ActorHasTag before deleting so that the character is just ignored by the volume.

        Comment

        Working...
        X