Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Using a Turn Provider and an Interpolated Rigidbody does not work

Discussion in 'XR Interaction Toolkit and Input' started by ShadowFlame45, Jun 10, 2023.

  1. ShadowFlame45

    ShadowFlame45

    Joined:
    Nov 6, 2021
    Posts:
    10
    As explained in the title, when using a turn provider, either continuous or snap, with an interpolated rigidbody, neither of them work properly.

    If it matters, I am using action based scripts, and my movement is updated in Update.

    Is there a way to either change the way or time a turn provider updates, work around interpolation, or, if neither of them, a solution to this in general?
     
  2. jeromeatunity

    jeromeatunity

    Unity Technologies

    Joined:
    Jul 1, 2018
    Posts:
    63
    Snap Turn is immediate and doesn't interpolate movement. Continuous Turn has a Turn Speed (Degrees/Second) you can use. Rigidbody interpolation is used when the object's movement is driven by physics, using methods like Rigidbody.AddForce. When teleporting or using snap turns, the Locomotion system is driving that movement, and will override the physics system. In that case, setting Rigidbody.isKinematic to true should avoid conflicts controlling the movement.

    upload_2023-6-12_22-16-4.png

    Just to cover all bases, have you imported the Starter Assets that include the pre-made Input Actions for XRI?

    upload_2023-6-12_22-11-6.png


    Adding this will give you these inputs:

    upload_2023-6-12_22-13-1.png
     
  3. ShadowFlame45

    ShadowFlame45

    Joined:
    Nov 6, 2021
    Posts:
    10
    Sorry for the extremely late reply. I don't check forums too often, so I did not know that you replied. I have imported the starter assets, but, as it has been a while since the initial post, I have fixed the problem myself. I wrote my own snap and continuous scripts that instead rotate using the rigidbody rotation. Regardless, thank you for your reply.
     
    jeromeatunity likes this.