player controller works now completely with camera movement
This commit is contained in:
@@ -29,10 +29,9 @@ public partial class player : CharacterBody3D
|
|||||||
{
|
{
|
||||||
playerResetPosition = Rotation;
|
playerResetPosition = Rotation;
|
||||||
camPosition = cameraCenter.Rotation;
|
camPosition = cameraCenter.Rotation;
|
||||||
playerResetPosition.y = camPosition.y;
|
playerResetPosition.y = camPosition.y * -1f;
|
||||||
Rotation = playerResetPosition / 2;
|
Rotation -= playerResetPosition;
|
||||||
Vector3 cameraResetPosition = cameraCenter.Rotation;
|
cameraCenter.Rotation = new Vector3 (camPosition.x,0,0);
|
||||||
cameraCenter.Rotation = new Vector3 (cameraResetPosition.x,0,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
@@ -68,7 +67,6 @@ public partial class player : CharacterBody3D
|
|||||||
Vector3 generalRot = Rotation;
|
Vector3 generalRot = Rotation;
|
||||||
if (Input.IsActionPressed("move_forward")) generalRot.y -= motionEvent.Relative.x * mouseSensitivity;
|
if (Input.IsActionPressed("move_forward")) generalRot.y -= motionEvent.Relative.x * mouseSensitivity;
|
||||||
Rotation = generalRot;
|
Rotation = generalRot;
|
||||||
|
|
||||||
generalRot = cameraCenter.Rotation;
|
generalRot = cameraCenter.Rotation;
|
||||||
if (!Input.IsActionPressed("move_forward")) generalRot.y -= motionEvent.Relative.x * mouseSensitivity;
|
if (!Input.IsActionPressed("move_forward")) generalRot.y -= motionEvent.Relative.x * mouseSensitivity;
|
||||||
generalRot.x -= motionEvent.Relative.y * mouseSensitivity;
|
generalRot.x -= motionEvent.Relative.y * mouseSensitivity;
|
||||||
|
Reference in New Issue
Block a user