SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

0 votes
0 answers
32 views

Hello, I am working for making a 3d model animation, but the problem I encounter is class ObjectModel3D has a dependency property named PositionProperty , but it has not a dependency property named XProperty or ZProperty, so I can’t use BeginAnimation or StoryBoard.Begin Class.

for StoryBoard Class, my code is:

_3dObject obj3d = new _3dObject();
         Vector3 vector3 = new Vector3();
         vector3.X = obj3d.ChassisModel.Position.X;

        var animationChassis = new DoubleAnimation()
        {
            From = obj3d.ChassisModel.Position.X,
            To = 100,
            Duration = new Duration(TimeSpan.FromSeconds(1))
        };

        Storyboard storyboard = new Storyboard();
        Storyboard.SetTarget(animationChassis,obj3d.ChassisModel);
        Storyboard.SetTargetProperty(animationChassis,new PropertyPath(ObjectModel3D.PositionProperty));
        storyboard.Children.Add(animationChassis);
        storyboard.Begin();

here Storyboard.SetTargetProperty(animationChassis,new PropertyPath(ObjectModel3D.PositionProperty)); is wrong because ObjectModel3D.PositionProperty can’t be applied.

for BeginAnimation, my code is :

TranslateTransform tt3D = new TranslateTransform();
        _3dObject obj3d = new _3dObject();
         var animationChassis = new DoubleAnimation()
        {
            From = obj3d.ChassisModel.Position.X,
            To = 100,
            Duration = new Duration(TimeSpan.FromSeconds(1))
        };

         obj3d.ChassisModel.RenderTransform = tt3D;

         tt3D.BeginAnimation(TranslateTransform.XProperty,animationChassis);

this code has no error(maybe), but it does nothing. I wanted to use TranslateTransform3D. but obj3d.ChassisModel.RenderTransform don’t correspond to TranslateTransform3D.

Do you have any thoughts about making an animation using ObjectModel3D or any other kind?
Please Help me!
Thanks!!

Update1
I’ve work on this for a whole day, I still didn’t find a way to animate a translation movement of 3d model.
I’m trying to add a dependency property to ObjectModel3D class.
if anyone has any idea, please bring it on.

Update 2
I doubt that ObjectModel3D could be used with DoubleAnimation or StoryBoard.
What I did is take a for loop to manipulate Position.X, and make sure to use second thread to do that.
PS : WPF is a bad platform for 3d model, U3D is better for C# user.

  • Jong Ming asked 7 days ago
  • last active 5 days ago
Showing 1 result
This template supports the sidebar's widgets. Add one or use Full Width layout.