MoveRotation on a kinematic TSRigidbody

Hey, I noticed this strange behaviour when using TSRigidbody.MoveRotation on a kinematic body. The problem can be reproduced as follows:
In the game scene create TrueSync Cube and set the kinematic trigger in the TSRigidbody Component to true. Now add a script containing the following OnSyncedUpdate() method:
public override OnSyncedUpdate() { //rotBody is referencing to the TSRigidbody rotBody.MoveRotation(rotBody.rotation*TSQuaternion.Euler(TSVector.up * 5 * TrueSyncManager.DeltaTime)); }
When I start the game the cube starts rotating smoothly up to 90 deg, but then suddenly stops and begins oscillating between roughly 82 and 90 deg. NOTE. If I set the body to non-kinematic the rotation is working perfectly!


  • JeffersonHenrique
    Humm, it is really strange, thanks for report that @airborne.
  • airborne
    edited March 2017
    Ok, I found a solution. I think it's because the TSQuaternions aren't properly normalized. I changed the set -accessor of rotation in TSTransform.cs to:
    set { _rotation = value; _rotation.Normalize(); if (tsCollider != null && tsCollider.Body != null) { tsCollider.Body.TSOrientation = TSMatrix.CreateFromQuaternion(_rotation); } }

    It's working fine now.
  • JeffersonHenrique
    Good catch @airborne, thanks!