I am moving my character with velocity. But (there is a bomb in game) when the bomb bombs it doesn’t addforce to character becasuse of velocity. Here is the movement code:
float y = Input.GetAxis("Vertical");
var v3 = -tra.forward * hız*y;
v3.y = rigi.velocity.y;
rigi.velocity = v3;
anim.SetFloat("f", y);
@Ege10
It’s because AddForce works using rigidbody velocity. In your movement script you are overriding it with your movement vector.
This are solutions that come to my mind:
.1. In movement instead of assigning movement to velocity, multiply current velocity by small number to simulate drag and add movement like that:
float drag = 0.1f;
float y = Input.GetAxis("Vertical");
var v3 = -transform.forward * hız * y;
rigid.velocity = new Vector3(rigid.velocity.x * drag, rigid.velocity.y, rigid.velocity.z * drag);
rigid.velocity += v3;
.2. When explosion happens disable movement for some time.
.3. Instead of assigning movement to velocity, add it and than in next update subtract last movement vector multiplied by drag force from velocity before adding the new one.
.4. Make explosion as Coroutine that lasts some time and adds this force to velocity after your movement script