Manually animating an object, wpf/SharpDX
See original GitHub issueI have an obj model that I load, like this:
public HelixToolkit.Wpf.SharpDX.MeshGeometry3D ModelCamera { private set; get; }
var m1 = Load3ds("data\\assets\\CameraMesh.obj");
this.ModelCamera = m1[0].Geometry as HelixToolkit.Wpf.SharpDX.MeshGeometry3D;
I link a transform in the xaml:
<hx:MeshGeometryModel3D
x:Name="model1"
Geometry="{Binding ModelCamera}"
Material="{Binding MaterialCamera}"
Transform="{Binding CameraTransform}" />
In the constructer, i can move the object, like this:
var matrixZero = new Matrix3D();
var transZ = new Vector3D(0, 10, 0);
var quatZ = new System.Windows.Media.Media3D.Quaternion(0, 0, 0, 1);
matrixZero.Rotate(quatZ);
matrixZero.Translate(transZ);
this.CameraTransform = new System.Windows.Media.Media3D.MatrixTransform3D(matrixZero);
However, when i run this function later on:
public void SetTransform(double val)
{
var matrixZero = new Matrix3D();
var transZ = new Vector3D(val, 0, 0);
var quatZ = new System.Windows.Media.Media3D.Quaternion(0, 0.707, 0, 1);
matrixZero.Rotate(quatZ);
matrixZero.Translate(transZ);
this.CameraTransform = new System.Windows.Media.Media3D.MatrixTransform3D(matrixZero);
}
It doesn’t do anything. What am i missing here to move an object from code-behind?
Thanks!
Issue Analytics
- State:
- Created 10 months ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Jerky animation when scrolling image in WPF using SharpDX
I am trying to smoothly scroll some images across a window using DirectX11 via SharpDX in a WPF application. A bit of background:....
Read more >Animation Overview - WPF .NET Framework
This overview provides an introduction to the WPF animation and timing ... It focuses on the animation of WPF objects by using storyboards....
Read more >helix-toolkit/CHANGELOG.md at develop
(WPF.SharpDX/UWP/WinUI); Improve node animation to avoid accumulated time ... Adds function to invalidate bone matrices/morph target weights manually (WPF.
Read more >Announcements · Helix Toolkit
Fixed · OrthoCam width getting clipped on zooming #1164 (WPF.SharpDX/UWP/Core) · Fix panning speed too huge causes object flying too far. Ref #1161...
Read more >helix-toolkit
HelixToolkit.SharpDX.WPF: Custom 3D Engine and XAML/MVVM compatible Scene Graphs based on SharpDX(DirectX 11) for high performance usage. HelixToolkit.UWP ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, InstanceParam is optional
You are binding to
CameraTransform
property, but you are implementing notification on_CameraTransform
.Or you can simply inherit a base class for your view model like this: ObservableObject, then