Hi All,
I’m stuck. I can’t get my entities to rotate however the values in the entity hierarchy are changing.
Context: I have a few hundred colliders in the scene. When the entity hits a collider, it turns on a ‘pixel’ assigned to that collider. This gives me a ability to create volumetric patterns within the diamond shape I have. The collider and pixel bits work, however I’m now trying to make my entities rotate outsides. They are box cones. There are 9 of them. As I adjust the Godray Expansion variable, I’m wanting these to fan out. I’ve rotated each of the cones in the editor within the subscene and have copied the quaternion values in the rotation I want. I’m then using quaternion.slerp() to rotate the cones to these positions.
I can see in the hierarchy that rotation and LocalToWorld values update, however nothing happens in the scene.
Inspector View
This is me adjusting the Godray Expansion variable and you can see that it is adjusting the quaternion values on the entity…
GameView
However as you can see nothing is updating. The entities aren’t rotating.
Scene View
This is the scene view with the Subscene loaded and opened when not in Play mode. Just showing for context of the scene) That scene cone is what I’m trying to rotate.
Rotation Manager
This is the code I’m using to do the rotation, which is causing the LocalToWorld cords and rotation cords to change.
[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
public partial struct RotationManagerJob : ISystem
{
public void OnCreate(ref SystemState state)
{
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
quaternion zeroedQ = new quaternion();
zeroedQ = quaternion.identity;
foreach (var transform in SystemAPI.Query<RefRW<LocalTransform>, RefRO<RotationalPivot>>().WithAll<RotationalPivot>().WithEntityAccess())
{
transform.Item1.ValueRW.Rotation = Quaternion.Slerp(zeroedQ, transform.Item2.ValueRO.rotationAmount, transform.Item2.ValueRO.rotationMultipler);
}
}
The box cones did have a physics body component attached to them - I thought this may have been stopping the rotation so tried setting the Motion type to Dynamic, Kinematic and removing the entire component with no luck.
What am I missing? I would have thought that I would have seen some rotational change with the rotation values.