Blender Git Commit Log

Git Commits -> Revision 60d0996

Revision 60d0996 by Campbell Barton (master)
July 9, 2008, 09:21 (GMT)
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

Commit Details:

Full Hash: 60d099648c05ac469e3499e9755477c5180b9721
SVN Revision: 15498
Parent Commit: 16dccd3
Lines Changed: +35, -7

2 Modified Paths:

/source/gameengine/Ketsji/KX_GameObject.cpp (+33, -6) (Diff)
/source/gameengine/Ketsji/KX_GameObject.h (+2, -1) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021