Hello! I'm trying to get an over-the-shoulder sort of look, using the standard MouseOrbit script and my own script to have the player turn to look towards where the camera is pointed.
My script is:
var cam : Camera;
function Update () {
var d3Point = cam.ScreenToWorldPoint(Vector3(cam.pixelWidth/2, cam.pixelHeight/2,50));
transform.LookAt(d3Point);
}
What is happening instead is that the camera jumps right behind the object, instead of off to the side. The player (just a cube with a cylinder attached) still looks where I point, but the view is all off. Instead of over-the-shoulder, it's right behind the cube. What I want:
o= camera | = body
o----
|----
What I get:
o-|----
I have: Player
Body
Gun
Main Camera </p>
with the turn script attached to Body (the one above) and the standard MouseOrbit on the Main Camera, with body fed in. (oh and main camera attached to cam on the turn script)
(THe full, small project: http://www.mediafire.com/?iwtwynmmm2t)