- Home /
third person character controller with rigidbody,how to make third person character controller.
hello, I am new to unity and I want to make the third person shooter game. but I have a problem I don't know how to make third person movement. I want to move the character by a rigid body. I see a lot of video on youtube but I can't get it. please help me to solve this problem.,hello, I am new to unity and I want to make the third person game. but I have a problem I don't know how to make third person movement. I want to move the character by a rigid body. I see a lot of video on youtube but I can't get it. please help me to solve this problem.
Answer by warrencwwong · Jul 04, 2019 at 10:19 AM
I would assume that your character does not have an animator. Use the roll a ball tutorial, that would most probably work.
public float speed;
private Rigidbody rb;
void Start () { rb = GetComponent();
}
void FixedUpdate () { float moveHorizontal = Input.GetAxis ("Horizontal"); float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed); }
The explanation: In your script, first, you need to get a reference of your rigidbody, by assigning it in the inspector or doing GetComponent(). Then, in your FixedUpdate() function, you check what input the player entered, by using Input.GetAxisRaw; At last, you apply your movement using rb.AddForce();
Answer by samarthgaming07 · Jul 11, 2019 at 10:56 AM
@ warrencwwong but how to rotate and move the character in the horizontal move. I am making humonid character movement.
Answer by Harsh_programmer · Apr 21 at 09:11 AM
Hello sir Feels like you are facing problems well I can help you with it ! Its not easy to explain a full third person character controller here but you can get the starter assets in the assets store link = https://assetstore.unity.com/packages/essentials/starter-assets-third-person-character-controller-196526 Hope it helps
Your answer
Follow this Question
Related Questions
Double movement speed moving in two directions 1 Answer
How do I make a 3d character only walk backwards? 1 Answer
Character Controller Move in X and Z axis via camera 1 Answer
Trying to fix my movement after the camera broke it. 0 Answers
Character direction can't be changed before the character reaches a screen limit in some cases 1 Answer