Extracting a rotation from 3D points

Blitz3D Forums/Blitz3D Programming/Extracting a rotation from 3D points

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I use align to vector on the x and z axis. A quick code snippet.

b\Mesh is your visible box, p[0] is your center vertet and p[5] .. p[8] are the top verlets starting from front left moving clockwise to rear left.

PositionEntity b\Mesh , EntityX( b\p[0]\pivot ) , EntityY( b\p[0]\pivot ) , EntityZ( b\p[0]\pivot )
x# = EntityX( b\p[6]\pivot ) - EntityX( b\p[5]\pivot ) + EntityX( b\p[7]\pivot ) - EntityX( b\p[8]\pivot )
y# = EntityY( b\p[6]\pivot ) - EntityY( b\p[5]\pivot ) + EntityY( b\p[7]\pivot ) - EntityY( b\p[8]\pivot )
z# = EntityZ( b\p[6]\pivot ) - EntityZ( b\p[5]\pivot ) + EntityZ( b\p[7]\pivot ) - EntityZ( b\p[8]\pivot )
AlignToVector b\Mesh, x,y,z,1 , 1
x# = EntityX( b\p[6]\pivot ) - EntityX( b\p[7]\pivot ) + EntityX( b\p[5]\pivot ) - EntityX( b\p[8]\pivot )
y# = EntityY( b\p[6]\pivot ) - EntityY( b\p[7]\pivot ) + EntityY( b\p[5]\pivot ) - EntityY( b\p[8]\pivot )
z# = EntityZ( b\p[6]\pivot ) - EntityZ( b\p[7]\pivot ) + EntityZ( b\p[5]\pivot ) - EntityZ( b\p[8]\pivot )
AlignToVector b\Mesh, x,y,z, 3 , 1


Stevie