Thanks.
I’ll most likely try this tonight.
Hello,
When working with scripts or plugins what is the default coordinates system which is used?
For example, Object.GetPoint returns a point coordinates expressed in the object coordinates system?
If the default coordinates system is the object coordinates system, I should use Object.Transform() to work in the world coordinate system?
If yes, do I need to use object.InverseTransform() before leaving the plugin?
That is my understanding – object points are default and relative to the group axis.
You must use both Transform/InverseTransform to return to object coords.
Thanks.
If I have 2 points from 2 different objects, how do I get the coordinates gap between the 2 points in order to compute a translation from one point to the other one?
(that’s why I wanted to work with world coordinates but according to Paul’s answer using Object.Transform() before getting each point coordinates won’t give me the actual world coordiantes of the 2 points)
Sorry if my answer was not clear.
The object.Transform will change the object point coordinates to world coordinates
The GetPoint before a Transform will get the point relative to the group axis.
Otherwise the difference between points is
GetPoint(A) + ParentGroupA.GetPosition (relative to root group)
subtracted from
GetPoint( + ParentGroupB.GetPosition (relative to root)
The object.Transform will change the object point coordinates to world coordinates
So, I can use GetPoint after a Transform will get the point world coordinates.
OK. So for this part, it’s now clear.
I can also use the solution with ParentGroupA.GetPosition and ParentGroupB.GetPosition.
And I still need some explanations:
It is not clear to me what the ‘root group’ is: the scene root? The root of the group of ObjectA and the root of objectB (in which case it will work only if ParentGroupA and ParentGroupB are under a same group)?
It may not work here:
[pre class=’ip-ubbcode-code-pre’]
Main
!— GroupLevelA_1
! !— GroupLevelA_2
! !— ObjectA
!— GroupLevelB_1
!— GroupLevelB_2
!— ObjectB
[/pre]
It will work here:
[pre class=’ip-ubbcode-code-pre’]
Main
!— GroupLevel_1
!— GroupLevelA_2
! !— ObjectA
!— GroupLevelB_2
!— ObjectB
[/pre]
GroupX.GetPosition Scene.GetRootGroup(),X,Y,Z
Effectively returns the GroupX position in world coordinates.
Everything is a child of Scene.GetRootGroup() (‘Scene’ in the hierarchy view) so it will work in all cases.
You must be logged in to reply in this thread.