So when you parent something to an object with irregular scaling-- i.e., scaled along some axes more than others-- the position of the child becomes offset and irregular, and moves incorrectly when the parent moves.
Is there a way to fix this, or at least correct for it?
I can’t “apply” the scale of the parent object because it changes scale in the game, plus there are multiple instances of it.
any time the object changes scale, unparent, and move to the inital localized offset, reparent.
local = own.worldPosition-own.parent.worldPosition
local = own.parent.worldOrientation.inverted*local
I think (I am not at my computer to check)
localiazing a world coordinate is very handy, you can then do thing like, if Y+ is in front of the player, you know anything with - y is behind you,
and you can calculate a view cone very easily using
## target is in front
if abs(local.x) <(10+local.y) and abs(local.z)<(10+local.y):
##target is inside cone of vision based on local position
Edit: you may have to scale also