- Home /
I do you control movements and apply other forces at the same time ?
I'm trying to make my character movements and I need to support movement (physics collisons) and adding other forces.. character gets hit for example. If I set the velocity manually it obviously ignores any other forces added to the object on the X axis (example bellow). How to I do this ? I want to add force and control movement at the same time.
currentVelocity = Input.GetAxisRaw("Horizontal") * speed * 10 * Time.deltaTime;
rigid.velocity = new Vector2(currentVelocity, rigid.velocity.y);
//X force 20 is ignored :(
if(Input.GetKeyDown("p")){
rigid.AddForce(new Vector2(20,30));
}
Comment
Your answer
Follow this Question
Related Questions
How to stop player velocity completely 1 Answer
How do I move this rigidbody? 1 Answer
Need help with my movement script.. :( 1 Answer
Move 3D camera on 2D plane 0 Answers