Rotating each triangle in a surface individually?

Blitz3D Forums/Blitz3D Programming/Rotating each triangle in a surface individually?

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.

A bit of Sine and Cosine. And it depends whether you want to rotate it about its Pitch, Yaw or Roll.

It would be something like this for pitch:

pitch#=pitch#+1
yaw#=yaw#+.5
For i=0 To 2
    ang# = 120*i  ;<-- Triangle Point
    x# = Sin(ang)*Cos(yaw)
    y# = Sin(ang)*Sin(pitch)
    z# = Cos(ang)*Cos(pitch)+Sin(ang)*Sin(yaw)
    VertexCoords surf,i,x,y,z
Next


A good way of working out whether to multiply by Sin or Cos is to remember that Sin starts off as 0 and goes to 1 at 90 degrees, whereas Cos is the other way round. So in terms of the x,y,z coordinates, think whether your vertex coordinate is stretched out at the start or if it is 0.