Three.js rotation over it's own axis

前端 未结 2 892
心在旅途
心在旅途 2021-01-01 08:13

I\'ve been trying to create a spaceship in a 3D space. It flies straight forward. You can change direction by rolling the spaceship and tip the nose up and down.

Whe

相关标签:
2条回答
  • 2021-01-01 08:32

    Check out Quaternions. In ThreeJS, the class you want to look at is THREE.Quaternion.

    Quaternions are generally used in flight simulation style games, and allow you to rotate in the local space of the craft, without getting "gimbal lock". ( That's when two of your axes become parallel, and you lose a degree of freedom. )

    This is a pretty good, and quite funny, explanation of quaternions: http://www.isner.com/tutorials/quatSpells/quaternion_spells_14.htm

    I hope that puts you on the right track...

    EDIT: Isner.com has long been offline, but I found the above tutorial on the Wayback Machine: https://web.archive.org/web/20120601095457/http://www.isner.com/tutorials/quatSpells/quaternion_spells_14.htm

    0 讨论(0)
  • 2021-01-01 08:41

    You don't have to understand quaternions for this - simply take a look here:

    Three.js - Rotating a sphere around a certain axis

    more than one simple solution!

    0 讨论(0)
提交回复
热议问题