My controls are wierd
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Player1 : MonoBehaviour { public float Speed;
private void Update()
{
PlayerMovement();
}
void PlayerMovement()
{
float hor = Input.GetAxis("Horizontal");
float ver = Input.GetAxis("Vertical");
Vector3 playermovement = new Vector3(hor, 0f, ver) * Speed * Time.deltaTime;
transform.Translate(playermovement, Space.Self);
}
}
Uhm please define what you understand by "wierd"... Your code should work just fine. However keep in $$anonymous$$d you apply your movement locally. So if your object is rotated "wierdly" you get "wierd" movement. Also keep in $$anonymous$$d that moving objects manually through the transform component will bypass physics. If you use some sort of rigidbody component on your object it would react to those movements but it can not handle the movement correctly. All it does is clean up the aftermath. That means if your code moves the object half a meter into a wall the physics system would detect the overlap and somehow applies seperation forces to your object(s). Those are not based on the movement you carried out since, as I said, you bypassed the physics system (if you actually use it).
You have literally zero explanation of your actual issue.
Like bunny said we need more information of what your goal is and why you are not reaching it. Also, have you tried Vector3 forces?
Your answer
Follow this Question
Related Questions
Character Rotation 0 Answers
Continous movement issue 0 Answers
How can I state the movement speed of this script? 0 Answers
Movement acceleration 1 Answer
Unusual movement script. Any ideas how to do that? 0 Answers