#Parent not adding when localTransform added

1 messages · Page 1 of 1 (latest)

steel drift
#

Hopefully the last one for the night...
So in the script it creates the entities with LocalToWorld components and then sets their parents, and it works and results in screenshot 1. However if I replace LocalToWorld with LocalTransform (as I believe is the proper way of going about it) the parenting and hierarchy just doesnt work and results in screenshot 2. Any help is appreciated.

west vault
#

LocalToWorld is mandatory with how the transform system's parenting system works (it's just how it is), and is also needed for other things like rendering with Entities Graphics. You can use LocalTransform with LocalToWorld if you wish, and the framework will fill in LocalToWorld based on LocalTransform's value and the parent's computed LocalToWorld. There's also the PostTranformMatrix component which can be used for additional transformations that can't be expressed with LocalTransform such as non-uniform scale, so LocalTransform+PostTransformMatrix+[parent transformation] -> LocalToWorld value.

steel drift
#

so do i have to manually add both LocalTransform and LocalToWorld?

west vault
#

yeah

steel drift
#

so that works for the hierarchy but now... the entities are invisible in the world

west vault
#

I don't see any initialization for the LocalToWorld of the chunk/block entities. Those need to each be initialized to Value = float4x4.identity to represent a usable default ("identity transformation").

west vault
#

yes

steel drift
#

still invisible ;(

west vault
#

try inspecting LocalToWorld values down the line, see if anything is all-0

west vault
steel drift
#

i figured it out

#

silly me

#

scale on all those localtransforms was 0

#

thank you though

#

i guess all thats left if you have any idea
at the bottomish of the script you can see it does some basic euler rotations and applies it to the localtransform
yet... the rotations look all wonky like this

west vault
#

DOTS stuff (specifically starting with Unity Mathematics) is in radians, either convert with math.radians(90f) or do 0.5f * math.PI