Hey all, as the title suggests - how do?
Below is my attempt... I have a reference to the entity (a basketball) stored in my MB script, I can change velocity with this method just fine, but when I change position, the basketball vanishes. Interestingly, its collider moves fine, even the shadow its casting on the floor, but not the actual basketball instead. If I look at the entity in the inspector, I can see that as soon as I override the transform position, the ChunkWorldRenderBounds changes its extents to (0,0,0)
private void SetLinearVelocity(Vector3 vel) //Works fine, happy rainbows and sunshine
{
ECSWorld.DefaultGameObjectInjectionWorld.EntityManager.SetComponentData(entity, new PhysicsVelocity
{
Linear = vel,
Angular = GetAngularVelocity(),
});
}
private void SetPosition(Vector3 pos) //Breaks the rendering on the entity - madness, badness & sadness
{
ECSWorld.DefaultGameObjectInjectionWorld.EntityManager.SetComponentData(entity, new LocalTransform
{
Position = pos,
Rotation = GetRotation()
});
}
Also, when I override the transform, my entitiy's LocalToWorld component changes... the first three rows all get overriden to zeros, with the final column still being the expected transform position... I'm a little confused as to the relationship between LocalTransform, LocalToWorld, PostTransformMatrix, and the position of the collider
If I modify this to instead change the LocalToWorld component rather than LocalTransform, the rendering doesn't break, but the entity only moves for a single frame, and then snaps right back to where it was