Pre loader

Adding ObjectModel3D object to SciChart3DSurface.SceneObjects in codebehind

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

I had great success using ObjectModel3D objects in my XAML file. However, I would like to dynamically add and remove objects based on user input. For this reason, I’ve switched to using codebehind.

private void PopulateScene()
      {
          List<Uri> bitmapImages = DataProcessor.bitmapImages();
          Uri textureSource = new Uri(@"C:\Users\Will\Desktop\lemon_yellow__85006.webp");
  
          var rotation = new Rotation3D()
          {
              Angle = 45,
              Axis = SciChart.Charting3D.Axis.Axis3D.YAxis
          };
  
          foreach(Uri bitmapImage in bitmapImages)
          {
              ObjectModel3D objectModel = new ObjectModel3D()
              {
                  TextureSource = new TextureSource(textureSource),
                  Source = new ObjectModelSource(new Uri(@"C:\Users\Will\Desktop\EarthTile.obj")),
                  Position = new Vector3(1, 0, 1),
                  CoordinateMode = ObjectCoordinateMode.Relative,
                  Scale = new Vector3(2, 1, 1),
                  Rotation = rotation
              };
  
              using (sciChart.SuspendUpdates())
              {
                  sciChart.SceneObjects.Add(objectModel);
              }
          }
      }
  

I get the correct model with the correct texture. However, setting the position, scale or rotation doesn’t seem to work. All objects are in the same place ((0, 0, 0), no matter the coordinate mode), at the same (1, ,1 ,1) scale, and facing the same direction. How

I also have this function;

private void ClearScene()
{
using (sciChart.SuspendUpdates())
{
sciChart.SceneObjects.Clear();
}
}

Even after the object is cleared from SceneObjects, it persists in the chart.

This leads me to my 2 questions;

  1. How do I get the objects I add to the chart to observe the
    transformational parameters I give it? I don’t need to change the
    parameters of objects after they’ve been added to the scene, just
    before.
  2. How do I remove objects from a scene?
Version
v7
  • Lex
    Hi Will, Thanks for your inquiry. I’m forwarding it to our developers and will get back to you as soon as I have an update. With best regards, Lex
  • Lex
    Hi Will, We’ve discussed your inquiry and we have planned to create a sample project for you. However, the soonest we can look at it is next week. Is this time frame comfortable for you? With best regards, Lex
  • Will Wright
    Sounds like a plan. Thanks!
  • Will Wright
    Was there any update on the sample project?
  • You must to post comments
Best Answer
0
0

Hi Will,

I’m glad to inform you that we’ve prepared a sample project showing how 3D objects can be dynamically added to the SciChart 3D Surface. Please find it attached.

Please let us know if this helps.

With best regards,
Lex
SciChart Technical Support Engineer

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.