- Home /
Rigidbody jitters when rotated by camera?
In FixedUpdate() I have:
Ray playerAim = options.playerCam.GetComponent<Camera>().ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
Vector3 nextPos = options.playerCam.transform.position + playerAim.direction * options.distanceHeld;
Vector3 currPos = objectHeld.transform.position;
objectHeld.GetComponent<Rigidbody>().velocity = (nextPos - currPos) * options.centeringSpeed;
This works reasonably well for faster, wider turns. However, for slower and smaller turns, it jitters.
Video here: https://youtu.be/SKtKGmQv7zU
I know it's been asked a several times, but I guess I don't understand it in the context of camera movement. Like I said, all my movement is in FixedUpdate(). I've tried messing with Interpolation as well.
Parenting it to the first person controller worked just above this code. No jitters. Really wish I didn't have to do that though. I understand that this worked because it's using the camera's rotation ins$$anonymous$$d of its own, but why doesn't it work otherwise?
Your answer
Follow this Question
Related Questions
OnTriggerEnter for parent AND child. 1 Answer
Enemies mess up force controlled Player 2 Answers
Connect rigidbody to another moving rigidbody to simulate a hanging weight 0 Answers
Unity Physics Best Practises 0 Answers
Problem with Colliders 1 Answer