I am currently creating a third person game where the character can manipulates gravity like in gravity rush, so you can walk in every surfaces where you aim like in the ps vita game. To do that I use a ray to know the normal of the surface where the player aim, so I change the rotation of the character, taking in acount that normal, and apply force to its rigidbody in that direction.
The problem is the rotation of the camera around the player in Y axis when you are in any surface different from the ground, because normally the camera rotate around the y axis , but when you change of surface it is not the same axis to rotate the camera, for example and inclined plane where the normal of the player is for example (0.6,0.3,0.7) so the camera has to rotate taking in account the normal or the transform.up of the character. In adition, when the character is in a new surface the camera rotates with him, so both have the same rotation. Maybe I don’t explain properly, sorry for that
I think that I have to use a cross product of vectors but I don’t get the right form, so I need a little help.The code that I use for the rotation of the camera around Y axis is:
transform.rotation=Quaternion.euler(0,mousedegress,0)
This code logically only works currently in the Y axis, so I have to modify it to work in any surfaces.
Thanks in advance.