|
Post by xxhaissamxx on Aug 19, 2017 12:36:33 GMT
i want player to always rotate with camera i changed Locomotion Type to Strafe Only but still same Basic Locomotion 1.1d and unity 2017.1Â
|
|
|
Post by sickscore on Aug 19, 2017 12:51:48 GMT
That's the intended behaviour when your character doesn't move. As soon as you move your character, it will rotate with the camera. If you really need to change this behaviour, then you can replace the "RotateWithCamera" method within your vThirdPersonInput with this one: protected virtual void RotateWithCamera(Transform cameraTransform) { if (cc.isStrafing && !cc.actions && !cc.lockMovement) { // smooth align character with aim position if (tpCamera != null && tpCamera.lockTarget) { cc.RotateToTarget(tpCamera.lockTarget); } // rotate the camera around the character and align with when the char move else { cc.RotateWithAnotherTransform(cameraTransform); } } } Of course you need some TurnOnSpot animations then Cheers, sickscore
|
|
|
Post by xxhaissamxx on Aug 19, 2017 15:31:52 GMT
That's the intended behaviour when your character doesn't move. As soon as you move your character, it will rotate with the camera. If you really need to change this behaviour, then you can replace the "RotateWithCamera" method within your vThirdPersonInput with this one: protected virtual void RotateWithCamera(Transform cameraTransform) { if (cc.isStrafing && !cc.actions && !cc.lockMovement) { // smooth align character with aim position if (tpCamera != null && tpCamera.lockTarget) { cc.RotateToTarget(tpCamera.lockTarget); } // rotate the camera around the character and align with when the char move else { cc.RotateWithAnotherTransform(cameraTransform); } } } Of course you need some TurnOnSpot animations then Cheers, sickscore Thanks I will try it
|
|
abhay
New vMember
Posts: 1
|
Post by abhay on Aug 20, 2020 6:29:00 GMT
I am using melee template and it doesn't work but here is the script I have created. It doesn't seem to be conflicting with RotateWithCamera.
public bool aiming; public GameObject player; public Transform cam; void LateUpdate() { if (aiming) { player.transform.rotation = Quaternion.Euler(0, cam.eulerAngles.y, 0); } else { return; } }
|
|