Hello!
Tell me how to implement a push when stabbed. That is, when I hit a bot or a player with a knife, so that it recoils.
MFPS 1.9
Push from a stab
Forum rules
To request support/assistance for MFPS, you first have to verify your purchase by sending your purchase invoice number to Lovatto in a PM.
To request support/assistance for MFPS, you first have to verify your purchase by sending your purchase invoice number to Lovatto in a PM.
- Lovatto
- Admin
- Posts: 1834
- Joined: Sun Dec 07, 2014 3:18 pm
- Contact:
Hi,
Sorry but I do not offer support for custom modifications,
I can only point you in the right direction.
In order to move a player you can apply the offset position to where the player will move to the 'moveDirection' vector in bl_FirstPersonController,
that Vector value is private so you will have to make a public property or a function inside the script, then you applied the "recoil" similar to this:
The code is not tested, it is just to give you an idea.
For the bots, is similar with the only difference that you will have to apply the offset position directly to the transform.position.
I hope this helps.
Sorry but I do not offer support for custom modifications,
I can only point you in the right direction.
In order to move a player you can apply the offset position to where the player will move to the 'moveDirection' vector in bl_FirstPersonController,
that Vector value is private so you will have to make a public property or a function inside the script, then you applied the "recoil" similar to this:
Code: Select all
void StabTest(Vector3 stabRecoil)
{
moveDirection += stabRecoil;
}
For the bots, is similar with the only difference that you will have to apply the offset position directly to the transform.position.
I hope this helps.