Blender Pythonのゲームスクリプティングを理解するために、私は現在、this linkのFPSController構造体を使用して球を歩き回ることができるシーンを構築しようとしています。任意の角度が180度以上になるまでおよそ働き、その後、不連続に見えるBlender:球を囲む
def main():
print("Started")
controller = bge.logic.getCurrentController()
me = controller.owner
distance, loc, glob = me.getVectTo((0,0,0))
grav = controller.actuators['Gravity']
strength = me['Gravity']
force = strength*(distance*distance)*glob
grav.force = force
try:
rot = Vector((0,0,-1)).rotation_difference(glob).to_matrix()
except Exception as E:
print(E)
rot = (0,0,0)
rotZ = me.orientation
me.orientation = rot*rotZ
controller.activate(grav)
main()
:重力とFPSControllerの向きについて私は現在、このようになりますのpythonコントローラを構築しようとしました。私はこれがrotation_differenceから不連続であると仮定します。blender documentation on Math Types & Utilitiesは何も言わないし、まだ連続的なマップが可能かどうかを確かめるために四元数の表現について十分に考えていない。そして、地元のZを達成するよりエレガントな方法があると思う方向は連続的にマウスに依存しますが、局所的なX方向とY方向は、与えられたベクトルに連続的に依存しますが、どのようにしますか?
3D空間での回転は非常に困難です。私の意見では、クォータニオンの理解に時間を置き、代わりにそれらを使用するのが最も簡単です。 – fluffels
オイラーアングル(クォータニオンの代わりに)を使用すると、ジンバルロック(http://en.wikipedia.org/wiki/Gimbal_lock)が発生する可能性があります。これはかなりの問題を引き起こす可能性があります – decden
これは簡単に試すことができますかあなたがBlenderをインストールしたときに出る? (Blenderの専門家ではない) – Gerard