Skip to content

New extension: <Quaternions> #1929

@MooseMakesGames

Description

@MooseMakesGames

Description

The extension adds Quaternion functionality to GDevelop. This avoids Euler angles by first converting to Quaternions. Issues like gimbal lock and order of rotations can mostly be ignored with quaternions. Any 3d rotations generally need quaternions and in future it will have slerp functionality, allowing interpolated rotations that are different to Euler interpolation. Made by InkedToast

How to use the extension

  • Convert Euler ZYX to Quaternion WXYZ
  • Convert Quaternion to Euler (The numbers may look different like a euler 100 100 100 will become -80 80 -80 after converting and then converting back as quaternions have multiple solutions, but the angle will still be the same)
  • Multiply Quaternion1 by Quaternion2
  • Quaternion Inverse
  • Quaternion normalisation (to make length 1)

All functions store values in Struct variables with children W X Y Z. In future the above will also be accessable through expressions. To use effectively convert Euler angles to Quaternion and apply rotations through Quaternion multiplication. Next keep rotations stored as Quaternions and apply by first normalising and then converting back to euler. To reverse a rotation, multiply by the inverse Quaternion.
Enjoy.

Checklist

  • I've followed all of the best practices.
  • I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
  • I am aware that the extension may be updated by anyone, and do not need my explicit consent to do so.

Example file

QuaternionExample.zip

Extension file

Quaternions.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions