- Home /
Question by
denzelkwok · May 08, 2020 at 12:38 PM ·
playerfollowweapon
How can player follow where the weapon is?
How can i set the player to follow the weapon(North, East, South, West). So if the gun move to the direction, the player also follow the weapon to the direction ? ANSWER WITH C# CODE
Comment
Best Answer
Answer by parachutingpotatochips · May 09, 2020 at 01:59 AM
In Unity, you could simply set the Player as a child of the weapon, but if you want c# code, then you want this in the player script: public Transform weapon;
void Update(){
transform.position = weapon.position;
transform.rotation = weapon.rotation;
}
Your answer
Follow this Question
Related Questions
Camera rotation around player while following. 6 Answers
How player follow the weapon only when weapon at North east south and west, not in diagonal 1 Answer
How to swap weapons easily? 1 Answer
How to have an object inherit rotation of player 1 Answer
How do i get a weapon to follow the first person controller up and down? 0 Answers