Quantcast
Channel: Questions in topic: "behind"
Viewing all articles
Browse latest Browse all 97

Character Controller / Own Camera Script Problem

$
0
0
Hello everyone, I wrote a custom third-person camera script. Right now it is very simple and it works. I changed from a rigidbody to the character controller because of jittering problems, and i dont use physics anyway. Actually my problem is that when i am walking and the camera is behind the player it jumps closer behind him. Is there any function in the standart asset that readjusts the cam behind the player if he is running? The problem doesnt show up when the camera is somewhere before or besides the player (you can rotate the cam 360° around him), only when the cam is behind him. Thanks for your help EDIT The script detects the input at the x and y axis. Then it calculates the distance between the camera and the player and set it to the maximum value if there is no object between, otherwise it reposition the camera in front of the detecting object. This all works fine if i have no character controller attached. Process: void Update () { rotateCamera(); followCharacter(); setFinalCamPosition(); } Final Cam Position: Vector3 vec3TempNewPosition = m_goTarget.transform.position + (m_fDistanceMemory * getVec3ForDirectionCalculation()); transform.position = Vector3.Lerp(transform.position, vec3TempNewPosition, 0.1f); transform.LookAt(m_goTarget.transform.position); There are no other functions who set the position. It is the last function who is called.

Viewing all articles
Browse latest Browse all 97

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>