- Home /
Camera twitching problem
Hello, fellow developers. I've been trying to create a point-and-click based game involving physics (i.e. explosions) but I'm running into some problems that I'm not sure how to solve.
The root problem is with the player itself: though it has a rigidbody, it is unaffected by my attempts at pulling all colliders with rigidbodies using OverlaySphere. The Use Gravity box is not checked, which I assume is the reason this is happening. However, ticking that box leads to the primary problem: The camera's twitching back and forth, while moving slowly downwards.
I'm using a very simple camera script, which might be the problem as well. Basically, it's fixed to a positional difference, and then updated to keep that difference.
var target:GameObject;
private var curPos:Vector3;
function Awake(){
curPos = transform.position;
}
function Update () {
transform.position = Vector3.Slerp(transform.position, target.transform.position + curPos, Time.deltaTime);
}
Comment