Download

Using trigger boxes to add a velocity to a second static mesh

Hi guys

I’m looking into how i can set up a trigger box so that when the player walks into the trigger a force is added to a second static mesh to interrupt the players progress.

I have found some tutorials on obstacles and setting up dynamic spawning, but none of them are really what i am looking for.

I will continue to search Unreal video library of tutorials, but if someone could give me some quick information about this or a decent tutorial that they have found that would be a huge help

Thanks

What exactly do you mean with “force”?
Just add a trigger actor (from the left upper window) into your scene - get a reference to it in the level bp so that you have an event - activate something with the event :slight_smile:

For Example:

Lets say the player is walking through a canyon, when he walks through a trigger box within the canyon it triggers a boulder to fall in front of them creating a hazard?

At the moment i have a OnActorBeginOverlap(TriggerBox) then i am adding a Add Radial Force Component and applying the sphere mesh that i have in the world as the target.

All i need to do now is add a force or impulse to trigger the sphere to move in the correct direction.

Not sure if that makes sense :slight_smile:

Add trigger, put your bolder in a blueprint, get ref to trigger in level bp, get on overlap begin event(overlap has to be activated on both actors), spawn your “bp_boulder” from class.
For the location you have many different ways. One is to place any object in level, where you want the boulder spawned.
Remember the xyz values and enter them in actor spawn loc. Use get actor loc. Enable physics in bp_boulder for static mesh.
For the “Hazard” part you need some health before you can subtract anything… https://www.youtube.com/results?search_query=ue4+health+tutorial
But i would put the bp_boulder at the cliffs and activate physics, when triggered.

d75d4d0a9a6c756fc63e37431fd5405f8bd75d73.jpeg

This is what i have so far. This is within the level blueprint. The Boulder is already in the level with simulating physics off so no need for the spawning. I have added a incline plane for the boulder to roll down after i have hit play.
What i want it to do now is when the character walks through the trigger box, it activates the simulating physics and the boulder rolls down in front of the character.

Any Ideas?

Search for “set simulate physics”, its a bool, make two of them one enabled, one disabled, connect both through a flipflop node and use a single keystroke, keypress for testing purposes.
Later use trigger to interact, when it is working like you want.

Blueprint 2.jpg

This is what i have so far, at the moment this isn’t working, i think i am nearly there.
Any ideas as to why this isn’t working?

Here is the way i use it, later i check the state of traced object and apply opposite state… It is in my char bp and i use traces for everything, because i like them. ^^
But you can get the target object in many ways.
Ah and when you want to use that sort of positional audio you have to use mono wave and make a cue out of them, use that, cool stuff.
dea70ad5867eba44a54f6ca0209800b48762a96a.jpeg

d99c3b05cce1fbb90b0eb0af4edf67dfe9102984.jpeg
This is what i have now.
Thanks for the help by the way! I feel like i’m getting closer.
I think i need something after the set simulate physics?

Have you physics enabled in your static mesh actor inside Boulder Blueprint?
You can disable it, with event start.
When you use simulate view and press buttons, is it working?
Use print string to check if nodes get activated.

Working Blueprint.jpg

This has starting working now, I’m not 100% sure why it is working i think it was because I used the trigger box with the OnActorBeginOverlap so when the actor walks through the trigger box it applies the simulation physics.

I now have a small issue with the sphere not colliding with the incline plane i gave it. (Fixed: changed the object to fixed not movable)

Thanks for all the help Luftbauch!
:smiley:

Glad that i could help. :slight_smile: