Hello I am a beginner and I literally have no idea what I need to do when it comes to killing vehicles when they go under the water. Would anybody do a step by step guide on how to do this?
Im assuming you mean they are no longer drivable.
Simply disable the movement component and physics.
After all players are out of the vehicle destroy it and spawn a static mesh copy of it in its place.
If I’m reading this correctly you want to destroy a car when it overlaps with a water asset.
You could create a Blueprint for the water and set it’s collision settings to query only or overlap all. Then in the car blueprint in event graph on actor begin overlap then other actor == BP_WATER→branch true → destroy actor.
Hi @Tactical_Force ,
First of all, I’m assuming you’re working with the first- or third-person template. If that’s the case, here’s one way to solve your problem:
1) Enable plugins
Make sure the following plugins are enabled:
- Chaos Vehicles
- Water
2) Vehicle possession system
Once the plugins are active, set up the logic to let the player possess the car and drive it.
You can use a tutorial video as a reference to understand how possession works.
3) Vehicle Blueprint changes
Inside your BP_Vehicle :
- Create a Custom Event called UnpossessVehicle and add the logic you created.
- Create another Custom Event called OnSinking.
- Add a boolean variable named bCanBePossessed, set to true by default.
In the OnSinking event:
- Set bCanBePossessed = false.
- Call UnpossessVehicle.
- Add a Delay.
- DestroyActor (Destroy the vehicle ).
4) Character Blueprint changes
In your BP_ThirdPersonCharacter:
- Create a Custom Event called PossessVehicle and add all the possession logic there.
- After the Cast To Vehicle, from the As BP_Vehicle pin, get the bCanBePossessed variable.
- Use a Branch: if true, allow possession; if false,don’t do anything.
This makes sure that once a vehicle has sunk, the player can’t interact with it again.
E key and IMC logic
5)Blueprint for sinking
Create a new Blueprint called BP_KillPlayerOnSinking:
- Add a Box Collision.
- In the OnComponentBeginOverlap event of the Box:
- Cast to your Vehicle BP.
- Call the OnSinking event.
This way, whenever the car overlaps with the box, it will trigger the sinking logic and get destroyed.
6) Level setup
In your level:
- Create a Landscape.
- Add water (i used the WaterBodyLake).
- Place the Box Collision from BP_KillPlayerOnSinking in the area where you want the vehicle to “sink.”
With this setup, when the vehicle goes into the water in that area, it will automatically unpossess the player, block any further interaction, and then destroy itself.
Hope this helps!
Thank you for that wonderful information I will definitely try this out today!