diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-07-09 13:21:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-07-09 13:21:52 +0400 |
commit | 60d099648c05ac469e3499e9755477c5180b9721 (patch) | |
tree | 63d8abada83e13e760ca25fdde42200c7afc2b08 /source/blender/nodes | |
parent | 16dccd3ffdb00bb81400c804b30b13de26d1dc10 (diff) |
added a factor argument for aligning to vector, this isn't correct since it does linear interpolation of the vector and renormalizes.
(can be improved to rotate correctly but for our use ist ok for now, would also be useful to have an argument to clamp the maximum rotation angle to get a constant rotation speed),
This will used to make franky upright when falling from an angle, to track to a surface when hanging onto a ledge and setting the glide pitch.
Without this rotation is instant and jerky.
currently this is done with Mathutils which isnt available in Blender Player.
def do_rotate_up(own):
own.alignAxisToVect([0,0,1], 2, 0.1)
replaces...
def do_rotate_up(own):
up_nor = Vector(0,0,1)
own_mat = Matrix(*own.getOrientation()).transpose()
own_up = up_nor * own_mat
ang = AngleBetweenVecs(own_up, up_nor)
if ang > 0.005:
# Set orientation
cross = CrossVecs(own_up, up_nor)
new_mat = own_mat * RotationMatrix(ang*0.1, 3, 'r', cross)
own.setOrientation(new_mat.transpose())
M source/gameengine/Ketsji/KX_GameObject.cpp
M source/gameengine/Ketsji/KX_GameObject.h
Diffstat (limited to 'source/blender/nodes')
0 files changed, 0 insertions, 0 deletions