[Solved] Incorrect local coordinate translation when using multiple components

Here you find reports of bugs, that have been fixed.
Should you encounter similar symptoms to a bug that is listed here, please create a thread in Technical Support: viewforum.php?f=964
kimbr
Posts: 3
Joined: Tue Jan 28, 2020 10:58 pm

[Solved] Incorrect local coordinate translation when using multiple components

Post by kimbr »

I ran into this issue while working on a lua specialization script for a mod. Here's the (much simplified) outline of the issue:

1. the lua script reads two node paths from a vehicle XML config key.
2. Next, it uses retrieves the nodes:

Code: Select all

node1 = I3DUtil.indexToObject(self.components, getXMLString(self.xmlFile,"path.to.my.key#node"));
node2 = I3DUtil.indexToObject(self.components, getXMLString(self.xmlFile,"path.to.my.key#baseNode"));
3. The world coordinates are retrieved:

Code: Select all

local xWorld, yWorld, zWorld = getWorldTranslation(node1)
4. The local coordinates relative to node2 are retrieved by using

Code: Select all

local xLocal, yLocal, zLocal = worldToLocal(node2, xWorld, yWorld, zWorld)
When node1 and node2 are part of the same component, this works beautifully.
But if they are part of two different components in the XML, the worldToLocal() call produces the wrong coordinates.

To make sure, I also tried this with node1 being a completely different object in-game. In that case, the expected results are returned.
Uruora
Former GIANTS employee
Posts: 118
Joined: Mon Apr 01, 2019 10:11 am

Re: Incorrect local coordinate translation when using multiple components

Post by Uruora »

Thanks for that, forwarded it to the devs
Post Reply