# Getting the lowest positioned vertex

This topic is 4957 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, I am trying to write a simple model program. When the user rotates a model I want the floor to touch the very bottom vertex. I have used Geometry bounding box to get the lowest, but this always returned the 'untransformed' vertex, i.e. without the rotation applied. I was perhaps thinking of using collision detection, but i'm not sure if this would just use the untranformed bounding box too. The model is also held in a vertex buffer so I can't use any .mesh methods on it. Speed isn't important because its not a game. If anyone has any pointers they would be much appreciated Cheers DRB2k2

##### Share on other sites
ok,
have managed to do it like this

Dim verts As CustomVertex.PositionNormalTextured() = CType(Me.VertexBuffer.Lock(0, 0), CustomVertex.PositionNormalTextured())        Dim i As Integer        min.X = 1.0E+18        min.Y = 1.0E+18        min.Z = 1.0E+18        max.X = -1.0E+18        max.Y = -1.0E+18        max.Z = -1.0E+18        Dim vec_Smallest As Vector3        For i = 0 To (Me.FacetCount * 3) - 1            vec_Smallest = verts(i).GetPosition            'transform it by the matrix            vec_Smallest.TransformCoordinate(Me.MatFromRender)            'now see if its smaller            If (vec_Smallest.X < min.X) Then                min.X = vec_Smallest.X            End If            If (vec_Smallest.Y < min.Y) Then                min.Y = vec_Smallest.Y            End If            If (vec_Smallest.Z < min.Z) Then                min.Z = vec_Smallest.Z            End If            If (vec_Smallest.X > max.X) Then                max.X = vec_Smallest.X            End If            If (vec_Smallest.Y > max.Y) Then                max.Y = vec_Smallest.Y            End If            If (vec_Smallest.Z > max.Z) Then                max.Z = vec_Smallest.Z            End If        Next        Me.VertexBuffer.Unlock()

Where MatFromRender is the matrix used in Device.setTransform

• 11
• 19
• 12
• 34
• 9
• ### Forum Statistics

• Total Topics
631398
• Total Posts
2999837
×