- Home /
Player keeps looking down
So, I'm completely puzzled. Not even sure if I should include a script because I can't pinpoint the cause of my issue. In a nutshell:
I added a tree enabler script, and it calls from the Player Prefab. So, before using it I updated the player prefab, and that's when things went haywire. Whenever I move the player (first person controller) they rotate, almost as if the head were moving forward, toward the ground, slowly. If I disable mouse look the issue goes away, but clearly that's no solution. Am just really baffled as to what is going on. In an order to fix the problem I used Windows Restore to bring back my Prefab folder from last night, but the same issue now continually happens. Has anyone seen this before? Any help is greatly appreciated. Thanks, and God bless.
EDIT:
Including tree enabler script.
Sorry about that. Should have included before. I'd gladly give more info, if I could figure out which info to include. Just so puzzled by this new issue that I don't even know where exactly to begin. Thanks for your patient help.
#pragma strict
var player : GameObject;
var turnOnDistance : float = 500;
private var playerPos : Vector3;
private var treePos : Vector3;
function Start ()
{
}
function Update ()
{
playerPos = player.transform.position;
treePos = gameObject.transform.position;
if(Vector3.Distance(playerPos,treePos) < turnOnDistance)
{
gameObject.SetActive(true);
}
else
{
gameObject.SetActive(false);
}
}
Look at the camera associated to FPC usually a child; does it have a weird location or rotation
You should try to include some more details so people can help you easier.
I'm not sure what a tree enabler script is so that's a problem for suggesting an accurate solution.
But it sounds to me that you need to double check the child objects associated with whatever is tilting like getyour411 suggested.
It also could be related to gravity if the whole character is just slowly falling over.
thanks to both of you. It appears it's the camera, not the entire player that's slowly rotating forward.
might need to see some other related scripts like camera/player. TreeEnabler seems to be fine
I agree, Tree Enabler didn't seem to show any issues inside the script. That said, I literally changed nothing else. No changes to the camera, the player, or any associated scripts, etc.
Answer by Conect11 · Jan 22, 2014 at 02:16 AM
so... ummm... the cord to my controller had gotten eaten by my chair leg. Once I fixed that the issue went away....
Walk of shame...