Added 3D player model, added better cam movement

This commit is contained in:
TAASONI3
2023-12-30 20:19:48 +01:00
parent f57389e8a4
commit 9ea4951312
49 changed files with 11586 additions and 1342 deletions

View File

@@ -10,8 +10,8 @@ namespace Assets.Scripts.Player
{
UIHandler uihandler;
GameObject interact;
public float mouseSpeed = 100; //the sensibility
public float controllerSpeed = 0.01f; //the sensibility
public float mouseSpeed = 10f; //the sensibility
public float controllerSpeed = 1f; //the sensibility
float xMaxLimit = 45.0f;
float xMinLimit = -45.0f;
Vector2 rotation = Vector2.zero;
@@ -27,7 +27,7 @@ namespace Assets.Scripts.Player
// Update is called once per frame
void Update()
{
transform.position = new Vector3(transform.parent.transform.position.x, transform.position.y, transform.parent.transform.position.z);
}
private void FixedUpdate()
@@ -50,17 +50,27 @@ namespace Assets.Scripts.Player
public void lookAround(Vector2 view, bool isController)
{
rotation.y += view.x;
rotation.x += -view.y;
rotation.x = Mathf.Clamp(rotation.x, xMinLimit, xMaxLimit);
GameObject target = GameObject.Find("targetLooking");
if (isController)
{
transform.eulerAngles = rotation * (controllerSpeed * Time.deltaTime);
target.transform.localPosition = target.transform.localPosition + new Vector3(view.x,view.y,0) * controllerSpeed * Time.deltaTime;
}
else
{
transform.eulerAngles = rotation * mouseSpeed;
//TODO: Look at camera movement -> Not rly smooth. Weird drag
target.transform.localPosition = target.transform.localPosition + new Vector3(view.x,view.y,0) * Mathf.Pow(mouseSpeed,2) * Time.deltaTime;
}
if(target.transform.localPosition.x >= 3){
target.transform.localPosition = new Vector3(3f,target.transform.localPosition.y,target.transform.localPosition.z);
}
if(target.transform.localPosition.x <= -3){
target.transform.localPosition = new Vector3(-3f,target.transform.localPosition.y,target.transform.localPosition.z);
}
if(target.transform.localPosition.y >= 2){
target.transform.localPosition = new Vector3(target.transform.localPosition.x,2f,target.transform.localPosition.z);
}
if(target.transform.localPosition.y <= -1){
target.transform.localPosition = new Vector3(target.transform.localPosition.x,-1f,target.transform.localPosition.z);
}
}