How do I get an associated entity's transform?

52 views Asked by At

Imagine I've crated an entity with transform:

let entity = world.create_entity().with(Transform::default());

How do I get its transform later having entity instance? E.g. (pseudo code):

let transform = entity.get_associated::<Transform>();
1

There are 1 answers

0
Aunmag On BEST ANSWER

Worked for me:

let transform = world.read_storage::<Transform>().get(entity);

It also can be write_storage.