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

Why when I press "RightArrow"the object do not go right?(only go forward),Why when I press "RightArrow" when the program start, the RES BOX does not move to right?

$
0
0
using System.Collections; using System.Collections.Generic; using UnityEngine; public class playerMovment : MonoBehaviour { public Rigidbody rb; public float ForwardForce = 2000f; // Start is called before the first frame update void Start() { } // Update is called once per frame //Fixed use when we use force or gravity something like that void FixedUpdate() { //To speed up rb.AddForce(0, 0, ForwardForce * Time.deltaTime); if (Input.GetKey(KeyCode.RightArrow)){ rb.AddForce(500 * Time.deltaTime, 0, 0); // Debug.Log("right"); } } }

Viewing all articles
Browse latest Browse all 1264


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