Getting Pitch/Yaw/Roll of a collided triangle

Blitz3D Forums/Blitz3D Programming/Getting Pitch/Yaw/Roll of a collided triangle

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.

Use a pivot and align it to the collision normals, then get the pitch, roll , yaw from this pivot :

global PIVOT = createpivot()

.
.
.
.

Nx# = 0
Ny# = 0
Nz# = 0
for c = 1 to countcollisions( Entity )
   Nx = Nx + collisionnx( Entity , c )
   Ny = Ny + collisionny( Entity, c )
   Nz = Nz + collisionnz( Entity, c )
next
aligntovector PIVOT, Nx, Ny, Nz, 2, 1

Pitch# = entitypitch( PIVOT )
Yaw# = entityyaw( PIVOT )
Roll# = entityroll( PIVOT )