Ok, I've been racking my brain on this for the last 2 hours... I hope someone can help.
All I'm trying to do is move the top vertex (0), away from or towards the base while still being able to rotate the triangle... that MoveVert doesn't do it, argh!
All I'm trying to do is move the top vertex (0), away from or towards the base while still being able to rotate the triangle... that MoveVert doesn't do it, argh!
Graphics3D 800,600 pivot = CreatePivot() cam = CreateCamera(pivot) MoveEntity cam,0,0,-10 Global axis=CreatePivot() mesh = CreateMesh() surf = CreateSurface(mesh) s# = .5 l# = 4 v0 = AddVertex(surf, 0, s*l, 0) v1 = AddVertex(surf, s, 0, 0) v2 = AddVertex(surf,-s, 0, 0) AddTriangle(surf,v0,v1,v2) EntityColor mesh, 10, 10,255 a# = 0 fps_milli=MilliSecs(): fps_counter=0:fpsworst=1000 While Not KeyDown(1) If KeyDown(203) Then TurnPoints surf,0,3, 0, 0, 1 ;left If KeyDown(205) Then TurnPoints surf,0,3, 0, 0, -1 ;right If KeyDown(200) Then l=l+.01:MoveVert(surf,2,l) ;up If KeyDown(208) Then l=l-.01:MoveVert(surf,2,l) ;down RenderWorld fps_counter=fps_counter+1 If (MilliSecs()-fps_milli)>999 fpstot=fps_counter fps_milli=MilliSecs() fps_counter=0 EndIf If fpstot<fpsworst And fpstot>0 Then fpsworst = fpstot Text 0,20, " FPS: "+fpstot+"/"+fpsworst Text 0,40, " tris: "+TrisRendered() Flip ;False Wend End Function MoveVert(surf%,v%,l#) vx#=VertexX(surf,v)+(l*VertexNX(surf,v)) vy#=VertexY(surf,v)+(l*VertexNY(surf,v)) vz#=VertexZ(surf,v)+(l*VertexNZ(surf,v)) VertexCoords surf,v,vx,vy,vz End Function Function TurnPoints(surf%,vertexIndex%,numberOfVertices%,x#,y#,z#) RotateEntity axis,x,y,z For i = vertexIndex To vertexIndex+numberOfVertices-1 TFormPoint VertexX(surf,i),VertexY(surf,i),VertexZ(surf,i),axis,0 VertexCoords surf,i,TFormedX(),TFormedY(),TFormedZ() Next End Function