How to make vehicle AI run down Player?

Hi,

I’m working on my 1st mobile game and want to achieve an vehicle AI (a lawn-mower to be specific) which runs down the player. The problem is I can’t get a proper AI setup, the vehicle has simulate physics on by default. So when the vehicle hits the player, both the player and the vehicle get knocked around. My Setup for characters is that when they are hit with enough velocity, they enter ragdoll. The current vehicle setup looks like the car is made up of paper and gets knocked around when player hits it !! plz help !!

I have referred Peter Newton’s Car AI for vehicle movement but the major problem is that physics of vehicle isn’t fitting well with my current physics based game situations.

Plz help guys !

So if I am hearing you right, you want the player to enter Ragdoll when he is hit by the lawn mower, but you don’t want the lawn mower to bounce off the player or be tossed around?

There are a couple options here.

First, you could select the Lawn Mower object and look at the details panel. Under physics you should see “Simulate Physics” and “Mass” Parameters. If you check both these boxes, and make the mass significantly higher than the player, he should not bounce off the player and will be “heavier” in the physics logic. This may help.

Second, at the bottom of the physics section in the details panel is a “Constraints” option, with a drop down arrow. Clicking this arrow will reveal 6 check boxes. Constraining the Lawn mower’s rotation along the X Y and Z axes could also possibly help. Also if you didn’t want the lawn mower to ever lift off the ground, constraining the Z axis would prevent this from happening.

The last option I can think of is a little more advanced and involves making the two objects ignore collision with each other but create some sort of overlap trigger event that would launch the character when he is overlapping the static mesh of the Lawn Mower. Here you would want to set the collision on the Lawn mower to overlap all dynamic or something, and then use the “launch player” node on “On Component Begin Overlap” or “On Component Hit”.

Hope this helps.

I had taken a look with the current options that u suggested … idk what I did but the car no longer bounces of … i was using 2 capsules for characters, one for ragdoll detection and one for normal character collision. I messed around with those n its working now.

But how do I make the vehicle AI run me down, if I placed move to node in BT and place destination as player actor, it kinda stops near me while i’m lying to the side of the lawn-mower. And if I use a calculated vector position for ‘move to’ in BT the node in BT only considers the value when the move to node is fired. Untill the move to is complete, it totally ignores the changes I make to black board variables.

i’ll try to reduce the braking and tweak some throttle input values. But honestly, I didn’t understand what exactly Peter has done to calculate the input for vehicle AI

I am not very familiar with Behaviour Tree’s yet but if I am hearing you right the following problem is happening:

The lawn mower moves toward the player and I am assuming knocks the player over and then stops.

And what you want is for it to run him over and continue moving?

If this is the case you might want to change the collision settings to overlap all dynamic. This will make the lawn mower trigger the “death” event when he comes in contact with the capsule you are referring to but will not stop the lawn mower from moving.

If you wanted the lawn mower to keep moving past the player to sort of “run the player down” you could then switch the move to destination to just past the character using some vector math if you had to, although I would guess that it might just do that automatically as is gradually slows down instead of coming to an instant full stop.

Try the collision settings first and let me know if that helps.

Yes, you got it right !

The capsules are on overlap and as soon as the ragdoll capsule detects an overlap, the mesh goes ragdoll and I disable the main capsule collision too. The vehicle knocks the guy properly.

Now working on move to node so that the vehicle actually follows the players even when blackboard value is a vector. Usually it ignores the changes once the move to is hit until it completes the movement.

Peter already made a custom move to node using a Task BP but the problem was I can only use either actor or vector. I can’t figure out a way to detect the variable type and extract the location from it accordingly. The following image shows a quick dirty way I did but it isn’t full proof … gets messy later!

If you anyone wants tuts on Ragdoll search for ‘Jonas Mølgaard’ and PeterNewton for Vehicle AI(also other AIs). There are lot of channels for AIs. I would suggest watching others too for better knowledge.