Announcement

Collapse
No announcement yet.

Help making a falling item pickup

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

    Help making a falling item pickup

    I've been trying to make a item container in the form of a balloon for my sidescrolling platformer game that when popped by the player spawns a item pickup that bounces into air before falling to the ground. Item pickups spawned from balloons differ from ones that aren't in that the non-balloon item pickups float in the air while the balloon-spawned ones are bound by gravity. Similar to how in Super Mario World 2: Yoshi's Island, coins normally float in the air but coins spawned from destroying a Winged Cloud causes coins to fly out and fall onto the ground. I've been able get the balloons to spawn items upon destruction but I've been having troubles with making the spawned items bounce up & fall to the ground in the manner that I want.

    I tried enabling physics on a item pickup blueprint parented to the main blueprint but I've found that enabling physics results in various undesirable behavior such as the item pickup bouncing into the background or foreground where the player can't reach it. As such, I don't think enabling physics is the way to go, so instead I was wondering if it were possible for Actor-class object to mimic the way that gravity affects Character-class objects by default such as my player character and the couple of enemies I've created? When my player character wanders off a ledge they are pulled straight down unto the ground by the force of gravity but are otherwise unaffected by physics, and I would like for the balloon-spawned item pickups to behave in a similar matter. When spawned, they should bounce up and then fall straight down, landing perfectly flat on the ground without it bouncing around or tipping off a ledge if the item happens to land on one.

    However, if enabling Character-class gravity without physics is not possible on a Actor-class object, then does anyone have any other suggestions?

    Any help whatsoever would be greatly appreciated!

    #2
    Perform a trace from the center of the object to the ground and when it falls and detects ground stop the physics? I hope it helps.
    I think there was a Boolean somewhere about it I'm not sure, to keep the object on the ground.
    Some cool unreal projects you may like!


    Developer of GOTA - Survivalism Gladiatorial game Buy the game google gladiators of the arena steam https://store.steampowered.com/app/7..._Of_The_Arena/

    Download the demo Download the demo
    external link Dropbox DropBox

    Become a c++ Professional now C++ Networking Tutorial

    Comment


      #3
      Sorry for the belated response. So if I have this right, I need to hook up a Boolean variable to the Set Simulate Physics event as well as a Line Trace by Channel set up. That way the item's physics can be switched off when the Line Trace detects a hit as the item hits the ground.

      Click image for larger version

Name:	simulate_physics.png
Views:	176
Size:	61.6 KB
ID:	1719413

      I also have another issue with the falling item pickup that I need help with. The issue I'm having is that for some reason I cannot set the item's collision so that the player can pickup the item by coming into contact with it like its non-physics-enabled counterpart. Instead the item is bounced away when the player comes into contact with the physics-enabled item. I've tried playing around with different collision settings but for whatever reason, I simply cannot enable the player to overlap the item while it has physics.

      Just for reference, this is the collision settings for the normal floating item pickup:
      Click image for larger version

Name:	collision_settings.png
Views:	152
Size:	39.9 KB
ID:	1719414

      While this on the other hand is the collision settings for the physics-enabled item pickup:
      Click image for larger version

Name:	collision_settings_2.png
Views:	151
Size:	40.2 KB
ID:	1719415

      So does anyone have any ideas on how I can allow the player to overlap the physics-enabled item?

      Comment


        #4
        Help, please?

        Comment


          #5
          With a projectile component, you can make the item to bounce into air before falling to the ground.
          Last edited by BaronPain; 02-13-2020, 09:54 AM.

          Comment


            #6
            Originally posted by BaronPain View Post
            With a projectile component, you can make the item to bounce into air before falling to the ground.
            Thanks for the suggestion!

            But does anyone know what I can do about the player collision issue?

            Comment


              #7
              Originally posted by Hungry Moogle View Post
              Thanks for the suggestion!

              But does anyone know what I can do about the player collision issue?
              Just Allow any Pawn overlap this component.
              Also, the best practice is to create your own collision channel (for better meaning and name this as 'PickUpItem' or somehow differently)
              Click image for larger version

Name:	Screenshot_20200213_193439.png
Views:	133
Size:	36.3 KB
ID:	1720842

              And make sure, in your Pawn at CapsuleCollision is Overlap PhysicsBody!

              Comment

              Working...
              X