Getting proper rebound...

Blitz3D Forums/Blitz3D Programming/Getting proper rebound...

Try this ...

For C = 1 To CountCollisions( Entity )
	Nx# = CollisionNX( Entity, C )
	Ny# = CollisionNY( Entity, C )
	Nz# = CollisionNZ( Entity, C )
	VdotN# = Vx * Nx + Vy * Ny + Vz * Nz
	NFx# = -2.0 * Nx * VdotN
	NFy# = -2.0 * Ny * VdotN
	NFz# = -2.0 * Nz * VdotN
	Vx = Vx + Nfx
	Vy = Vy + Nfy
	Vz = Vz + Nfz
Next
AlignToVector Entity, Vx, Vy , Vz ,  3, 1


Where Vx, Vy and Vz are your velocity vector. Remember to make them floats.

Stevie