Quantcast
Channel: Questions in topic: "follow"
Viewing all articles
Browse latest Browse all 536

Camera following Pivot not working

$
0
0
I want to make a thirdpersonshooter-camerascript the player is the parent of an empty(pivot) and the camera should follow the pivot ![camera][1] when i move my mouse to the left the player rotates to the left with the pivot but the problem lies with the camera: it keeps the distance to the pivot but it doesnt inherit the rotation (red is how the camera is, green is how the camera should be) ![alt text][2] following the responsible part of the cameracontroller: //rotation of the camera transform.position = pivot.transform.position + (pivot.transform.rotation * (new Vector3 (0.5f,2,-2))); targetlook = Quaternion.LookRotation (pivot.transform.position - transform.position); transform.rotation = Quaternion.Slerp (transform.rotation, targetlook, smoothlook * Time.deltaTime); transform.LookAt (pivot.transform); any advice? [1]: /storage/temp/51420-camerasetting1.jpg [2]: /storage/temp/51421-camerasetting2.jpg

Viewing all articles
Browse latest Browse all 536

Trending Articles



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