vertex in view
Blitz3D Forums/Blitz3D Programming/vertex in view
| ||
Anybody know of a quick way to calculate if a vertex is in view of the camera? |
| ||
Put a pivot where the vert is and then do an EntityInView(). |
| ||
You'll have to do it like this: (clarification of beakers method)TFormPoint VertexX(surf,i),VertexY(surf,i),VertexZ(surf,i),entity,0 PositionEntity Pivot,TformedX(),TformedY(),TformedZ() If EntityInView(Pivot,Camera) Then ;Yadda Yadda |
| ||
Thanks guys, exactly what I needed. |
| ||
The way I do it (which is, as far as I'm concerned, far more accurate when it comes down to a point in space):TFormPoint VertexX(Surface,Index),VertexY(Surface,Index),VertexZ(Surface,Index),Mesh,0 CameraProject Camera,TFormedX(),TFormedY(),TFormedZ() Visible = True If ProjectedZ() <= 0 Then Visible = False Else PX = ProjectedX() If PX < -4 Or PX > GraphicsWidth()+4 Then Visible = False Else PY = ProjectedY() If PY < -4 Or PY > GraphicsHeight()+4 Then Visible = False EndIf EndIf EndIf |
| ||
Thanks Noel, I forgot all about Projected_. |