Slope Collisions

Blitz3D Forums/Blitz3D Beginners Area/Slope Collisions

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.

To align the character to the slope use ...

;calculate normal of slope
Nx# = 0 : Ny# = 0 : Nz# = 0
for c = 1 to countcollisions( p\Pivot )
   Nx = Nx + collisionnx( p\Pivot , c )
   Ny = Ny + collisionny( p\Pivot , c )
   Nz = Nz + collisionnz( p\Pivot , c )
next
;align character on y-axis - does not need to be normalised
Aligntovector p\Pivot , Nx, Ny, Nz, 2, .25 

To rotate use ...
YAW = keydown(203) - keydown(205)
turnentity p\Pivot, 0, YAW, 0

To move use ....
tformvector 0,0,p\Speed, p\Pivot , 0
translateentity p\Pivot, tformedx(), tformedy(), tformedz()


Untested but this is what I use.

Stevie