Helix3d WPF draw text at the top/left of HelixViewport3D

302 Views Asked by At

I want to show some text information at the top/left of HelixViewport3D like "ShowCameraInfo" does, which display camera information at the bottom/left of the Viewport. BillboardTextVisual3D requires a 3D point, but what I want is just like TextBlock on Canvas, which just need a 2D coordinate. I can use TextBlock, but it cannot be captured as part of HelixViewport3D. Any idea?

1

There are 1 best solutions below

1
dwpessoa On

Literally a Textblock placed over the HelixViewport3D should be what you need.

There is only one problem: Viewport will not recognize if you try to manipulate the camera by initiating the mouse click on the Stackpanel.

<Grid>       
    <hx:HelixViewport3D>
        <hx:DefaultLights/>
        <hx:CubeVisual3D SideLength="7"/>
        <hx:CubeVisual3D SideLength="5" Fill="Red" Center="-5,3,0"/>
    </hx:HelixViewport3D>

    <StackPanel Margin="5" HorizontalAlignment="Left" VerticalAlignment="Top">
        
        <StackPanel.Background>
            <SolidColorBrush Color="#FFB6B6B6" Opacity="0.4"/>
        </StackPanel.Background>

        <TextBlock Text="asdhfasdvfmnas" Margin="5,2"/>
        <TextBlock Text="mvcbnxcvjhbkdaf" Margin="5,2"/>
        <TextBlock Text="vbkjsdvj" Margin="5,2"/>

    </StackPanel>
</Grid>

enter image description here