I’m trying to make a third person shooter like Risk of Rain 2. I’m using a Freelook camera using the Lock to Target No Roll binding mode and using the Composer Aim mode.
I want the various pullback stages in the Y axis of the orbital camera, but I want the player’s back to always be facing the camera since it’s a shooter. Giving the Freelook camera control of the X axis made the aiming accurate, but prevented the player from strafing. When the player moved left and right, the player would start orbiting around the camera. I want the player to be able to strafe without rotating, and for the player to rotate with horizontal mouse movement.
I removed the virtual camera’s control of the x axis by deleting “Mouse X” from the horizontal axis field and enabled “Recenter to Target Heading” and set Wait Time and Recentering Time to 0. I’ve also set all damping options to 0.
I then used the Mouse X to rotate the player in a script. The virtual Freelook camera does follow it, but it lags behind the rotation. After I stop moving the mouse, which is when the player stops moving, the camera continues to catch up with the player’s rotation. Video of issue is below:
In my script, I’ve tried updating the player’s rotation in LateUpdate, FixedUpdate, and Update, but all return similar results.
void LateUpdate() {
//rotation
mouseInput = Input.GetAxis("Mouse X");
transform.Rotate(new Vector3(0, mouseInput * mouseXSpeed, 0), Space.Self);
print(mouseInput);
}
Here are screenshots of my virtual camera settings: Imgur: The magic of the Internet
This isn’t ideal for a shooter, since the camera continues to move after the mouse stops moving.
I’m not sure if I’m doing something wrong like not using the right Update function, or if strafing without rotation with the Freelook camera isn’t possible.
Any help is appreciated!