Question by
ib970712 · Apr 07 at 09:32 AM ·
rigidbodyaddforcemoveposition
RigidBody Addforce While using Moveposition
Hi! I am attaching a rigidbody to a character and controlling it using moveposition. I want to push the character using Addforce.
When I press U, my character is Addforced.
if (Input.GetKeyDown(KeyCode.U))
{
rb.AddForce((-transform.forward).normalized * force, ForceMode.Impulse);
animator.SetTrigger("Banged");
}
FixedUpdate()
{
(...skip)
rb.MovePosition(rb.position + moveDir * Time.fixedDeltaTime * moveSpeed);
}
However, after addingforce, the character returns to its original position. How do I move a position to an addforced position?
Here is Help Img Link
Thank you!
Comment
Your answer
Follow this Question
Related Questions
myRigidbody.MovePosition influences the force. 0 Answers
How to remove addforce effect 0 Answers
Rigidbody.addForce is not working 10 Answers
Having a OnTriggerEnter make another gameobject Add Force in UnityScript. 1 Answer
How to set rigidbody velocity and angularVelocity to Vector3.zero over time? 1 Answer