AB4D Forum
Point3d position - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: Point3d position (/showthread.php?tid=4191)



Point3d position - kreativasas - 04-22-2020

Hi everybody, I need an help..
I have in my scene a sphere and a 3dpoint wich is the centerposition of the sphere

When i make a transformation to the sphere i need to move the point to the new sphere centerposition but if i read the new center position of the sphere after the transformation i get the original position ever.

How i can move the point to the new center position? 
Thanks for replies


RE: Point3d position - abenedik - 04-23-2020

Do you mean SphereVisual3D.CenterPosition as the "centerposition"?

You have two options:
1) instead of applying a TranslatTransform3D on the SphereVisual3D, you can just change the value of the CenterPosition.

2) to get the transformed centered position you can use:

var transformedCenter = modelVisual3D.Transform.Transform(sphereVisual3D.CenterPosition);


Note that transformation are hierarchical - so you can have a hierarchy of objects - for example:

ModelVisual3D
   ModelVisual3D  
      SphereVisual3D
      BoxVisual3D

So if you apply the transformation to the first ModelVisual3D this will transform all child objects, but CenterPosition on SphereVisual3D and BoxVisual3D will not change - the values of those properties are defined in the local coordinate system (and not in world coordinate system).