Hello again guys.
I have made a script which handles the doors in my scene, dependant on mouse click and drag.
I have a problem that I can hardly describe, but I have recorded it in a video, so you guys
can see what the problem is; Dropbox - Error - Simplify your life
as you can see in the video, when I click the door and drag the mouse, the door rotates, but
it stutters very much, and this is obviously not the way I want it to be.
I’m doing a raycast that detects when I’m looking at the door, and if I am, it checks for MouseButton(0) input.
If it gets a MouseButton(0) input, then this script runs on the door:
public var cameraObject : GameObject;
public var factor : float = 4;
public var parentObject : GameObject;
function FixedUpdate ()
{
if( cameraObject.GetComponent(RayCast).cellDoorClicked == true )
{
if( Input.GetAxis("Mouse X") )
{
audio.Play();
parentObject.rigidbody.AddTorque(0, -Input.GetAxis("Mouse X") * factor, 0);
}
}
}
Any idea how to fix this to that the movement becomes smooth? Does it have something to do with the update function?