简体   繁体   中英

Unity3D Quaternion libGDX equivalent

Quaternion.Lerp

static Quaternion Lerp(Quaternion from, Quaternion to, float t);

Description: Interpolates between from and to by t and normalizes the result afterwards. This is faster than Slerp but looks worse if the rotations are far apart.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Transform from;
    public Transform to;
    public float speed = 0.1F;
    void Update() {
        transform.rotation = Quaternion.Lerp(from.rotation, to.rotation, Time.time * speed);
    }
}

Could you write down a quivalent in libGDX please? I'm trying to do long time and without success.

libGDX has slerp method:

slerp(Quaternion[] q) Spherical linearly interpolates multiple quaternions and stores the result in this Quaternion.

https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Quaternion.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM