Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Rigidbody.addforce not working,i cannot get my AddForce function to work. it reads the input but will not make the player move. the player has a rgidbody on components as well.

$
0
0
My player character has a rigidbody but the addforce function is not making the character move. ive tried putting it in the FixedUpdate and the normal Update. public class PlayerMovement : MonoBehaviour { public float moveSpeed; private float maxSpeed = 6; private Vector3 input; void Start() { } void FixedUpdate() { if(GetComponent().velocity.magnitude < maxSpeed) input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); GetComponent().AddRelativeForce(input * moveSpeed); } } ,

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>