[Solved] How can I get object in center of screen?

Entity has camera subobject and I want to get an entity in front of it.
I tried this but it always returns false.

    var direction = Vector3.UnitZ;
    Entity.Transform.Rotation.Rotate(ref direction);
    var hitTest = _rigidbody.Simulation.Raycast(Entity.Transform.Position, Entity.Transform.Position + direction * 10);
    Debug.WriteLine($"Hit: {hitTest.Succeeded}, {direction}");

Did you properly add physics colliders in all those entities ?

Added rigidbody with box collider.

Hello.
I think the camera is facing in the opposite direction of the owner entity.

var direction = -Vector3.UnitZ;

I tested all directions before though tried that for clarity and it didn’t help. OK, here’s actual project.
But thanks for tip about camera, it was turned to negative Z indeed :slight_smile:

Ok, it just solved itself somehow