Quantcast
Channel: Latest Questions by Rangicus
Viewing all articles
Browse latest Browse all 6

Cannot use rigidbody and change velocity at the same time

$
0
0
I am programming a 2.5D game where it is 3D, but the camera looks on as if it is in 2D. I typed in some simple movement code so that I could move, here is the code. using UnityEngine; using System.Collections; public class PlayerController : MonoBehaviour { public float speed; void Start(){ gameObject.renderer.material.color = Color.green; } void FixedUpdate(){ float moveHorizontal = Input.GetAxis ("Horizontal"); Vector3 movement = new Vector3(moveHorizontal, 0f , 0f); rigidbody.velocity = movement * speed; } } So, the problem is that my cuboid character falls very slowly to the ground. The speed variable is set to 3 in the inspector, and the character has a rigidbody with gravity on, can't figure out how to fix this, help?

Viewing all articles
Browse latest Browse all 6

Trending Articles