How can I make balls drop when the player steps on a platform?

I have a couple balls that on impact launch the character with a sphere collision. I want to have them suspended in the air and then drop when the player steps the inclined platform (or enters the box outline in the pic). I’m having the hardest time figuring this out, any help is much appreciated <3

1 Like

I see you already got a collision box to detect when the player enters the area. You can use an “On Event Hit” node or overlap if physics is turned off, then plug that event into a “Set Enable Gravity” node. Plug in your sphere into the target pin of that node and click on the the gravity enabled checkbox

1 Like

Thanks for the input! I think I’m messing something up though because I made this

But it’s not activating. I have physics off in the details panel for the sphere. Could it be that the collision box is built in the wrong spot? I have it under the sphere BP and when playing, the Event Hit node doesn’t even activate.

Obviously I’m new to this, trying to learn while working a FT job T_T Thanks again!

Did I say event hit? I meant to say on component hit :rofl: and if physics are off, use “On Component Overlap”

I don’t think I’m following here because the nodes you’re describing aren’t showing up :confused:

On component begin overlap doesnt show up? (Yeah i couldnt say the exact name again :sweat_smile: ) Maybe try turning context sensitivity off

If the sphere is not simulating physics you would need to turn that on too (in the triggerbox overlap).

Alternative approach: set the sphere to simulate physics but disable gravity in details panel (to keep it suspended in the air), then on character - triggerbox overlap, enable gravity.

I must be doing something wrong lol

Hey thanks for the answer! The triggerbox overlap is what’s confusing me though. Do I need to set an overlap node in the character BP?

Oh yeah just like @silnarm mentioned you would need physics for it to be affected by gravity. My mind went to On Component Overlap not being required to have phsyics on but I forgot that aspect of the objective :rofl: oh my mind is such a mess rn

Also I think you just created an event with that name, it doesn’t seem like that’s the built-in event you’re using. And you should have execution pins connected as well, those white lines. And you can use “On Component Hit” as well in this case. Though make sure your actors are set to block it and not overlap

The overlap test can be on either the character or trigger box.

I would derive my own trigger box and do it there, so I could also have a instance editable ball reference and connect it up to the ball to drop in the editor.

That did it, thanks a million bro! I owe you a beer, or something if you don’t drink lol

Also @VisAgilis thank you too, my mind is a mess rn too, I guess that’s what I get for trying to multitask haha

Cheers gents

Quick question, how could I add more balls that have the same rule? In the pic, there’s the launch on touch which launches the player when colliding with the ball, and the start the drop is the box collision that enables the drop

image

But Sphere 3 doesn’t do anything, and if I add a sphere with start the drop selected, the physics get all out of wack

Not entirely clear what you are trying to do there… drop two balls from one trigger?

Whatever the exact goal, with the sphere simulating physics it will drag all its components around with it, which may not (or may) be desirable (thinking of the triggerbox…), the second sphere also being a child of the first is the bigger problem and is not going to work out.

Do you want the trigger to move with the ball?

I would highly recommend using separate actors for the ball (a dynamic thing that is going to move around) and trigger (a static thing that is not going to move). If you want multiple balls dropped from one trigger, just change it’s Ball variable to an array (and rename it Balls, of course!) and loop over the array setting gravity on.

What I was trying to do is to have multiple balls drop as soon as the player hops on the platform. With one ball it looks like the image I sent earlier with the box collision, and if I Alt+drag to duplicate the ball (and the 2 collisions) it becomes a bit of a mess and the collision boxes for them to drop would be too far out of reach and would never trigger.

I could just change the position of all the box collisions but that seems sloppy and dumb to do. Dies the setup with the arrays instead of variables that you mentioned apply to this?

Yes.

Separate the trigger into it’s own actor (derive from TriggerBox though, not Actor), give it an array of Ball object refs (instance editable) and put this in its event graph:

Connect the trigger up to the balls it should drop in the editor:

Gotcha, I’ll dive deeper on how to do that, I think I can figure it out because an array is just a bunch of variables (I think). Thanks again dude!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.