- Home /
 
PlayerMove script affecting gravity.
So I have a rigid body movement script and whenever I turn on the script the gravity is very slow. The gravity is the default -9.81.
Here is the movement script:
using System; using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerMove : MonoBehaviour {
 Rigidbody rb;
 Vector3 velocity;
 float moveSpeed = 4.0f;
 // Start is called before the first frame update
 void Start()
 {
     rb = GetComponent<Rigidbody>();
 }
 // Update is called once per frame
 void Update()
 {
     UpdateMovement();
 }
 void UpdateMovement()
 {
     Vector2 inputDir = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
     inputDir.Normalize();
     Vector3 velocity = (transform.forward * inputDir.y + transform.right * inputDir.x) * moveSpeed;
     rb.velocity = velocity;
 }
 
               }
               Comment
              
 
               
              @vinny1945 Could you maybe explain what you are trying to achieve? Because I see a lot wrong with your code. :)
Your answer
 
             Follow this Question
Related Questions
ANSWER DETERMINED (CAN'T DELETE) 1 Answer
Gravity and rotation control 0 Answers
Player colliding with pickable object 0 Answers
After Restarting Scene, Player can't move anymore 0 Answers
Gravity slower when moving Rigidbody 0 Answers