0
Under review

Need Advice On How To Sync Coordinate Systems

Anonymous 10 years ago updated by ไอยดา สุรีวงค์ 4 years ago 2
This discussion was imported from CodePlex

BogusException wrote at 2014-07-06 20:41:

Experts,

I'm still getting using the FlightsDemo to create a proof for a project I want to do. The objective is a rotating globe with the flights on them, just like they are in the demo files included with the product today.

I am running into an issue/situation whereby I can't figure out how to translate the mouse click to the proper coordinates on the Sphere... The biggest demonstration of this issue is this:

-As the Sphere is rotating:
 <Grid.Triggers>
            <EventTrigger RoutedEvent="Canvas.Loaded">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation x:Name="Rotate360"  From="0" To="360" Duration="0:2:00" AutoReverse="False" 
                                         RepeatBehavior="Forever" Storyboard.TargetName="rotation" 
                                         Storyboard.TargetProperty="Angle" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Grid.Triggers>
[...]
<t:SphereVisual3D x:Name="TheEarthSphere" 
                              Material="{StaticResource EarthJPG}"
                              Radius="1" 
                              ThetaDiv="25" 
                              PhiDiv="25" >
                <t:SphereVisual3D.Transform>
                    <Transform3DGroup>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,0,1" Angle="0" x:Name="rotation" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </Transform3DGroup>
                </t:SphereVisual3D.Transform>
            </t:SphereVisual3D>
...the lat & lon at the top left of the WPF Window do NOT update. They are tied to the non-animating coordinate system of the Viewport, which is illustrated by the little cube on the bottom right:



-As the cube is rotating, when I do click on it, based on the current coordinates of the Viewport (little cube, lat & lon at top left of display), that is where the tube will be placed. This means:

-No matter what the rotating sphere is doing, the lines will be placed on the sphere at THOSE coordinates, NOT where he mouse was over when clicked.
-Imagine you are clicking on a rotating sphere in the same (relative) position, say, dead center. The tube (flight) is placed on the rotating sphere, but always in the same place.

I know this is just a matter of finding a way in Helix 3D to rotate the little cube at the bottom right as the sphere is rotating, but there are virtually no docs, and I can't figure out how to tie them together.

Q: In other words, how to make the little navigation cube at the bottom right reflect the position of the sphere as it rotates? Or can I just get the Sphere coordinates from a click somehow?

An example might help.

Here is the window as it starts. Note the nav cube (we'll call it) position at bottom right, and where the sphere (earth) is in it's rotation, as well as the lat & lon at the top left:





You should notice a few things from the above 2 screenshots:
  1. The position of the mouse is (almost) the same, and so is the lat & lon at top left.
  2. The sphere, however, has rotated between these 2 images, and the mouse is obviously over a different lat & lon on the 2nd shot as it was in the 1st.
  3. The nav cube at bottom right stays still.
Analysis:

It appears that the nav cube is for the viewport coordinate system by default (would love to change that to the Sphere).
The Shpere, and it's child material) are rotating fine.
The click/hit point(s), though do NOT reflect the 3D point on the sphere clicked, but rather the 3D point in the viewport coordinate system.
I have even tried to rotate the camera around the Sphere, but I can't find documentation on how to accomplish this (leave Sphere static, rotate the camera in an orbit around sphere, looking at 0,0,0)...

My Request:

Please tell me how to tie the place the mouse is clicked on the sphere with the sphere coordinates of that click/hit.

Any hints, guidance, example greatly appreciated!

P.S. Is there an example of AnimateOpacity?

objo wrote at 2014-07-11 21:55:

Can anyone help on this? Is there a bug? Transform of the model/visual not being included?

BogusException wrote at 2014-09-18 19:00:

Still no thoughts on the question above:

P.S. Is there an example of AnimateOpacity?
Under review
AnimateOpacity is used by the HelixViewport3D to animate the opacity of the view cube viewport.

Tip: Use "Find Usages" (Shift+F12 with my shortcut layout) in Visual Studio when you want to find examples!