You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an EnTT beginner, I want to dynamically set component properties using strings. For example, how can I set registry.get<velocity>(entity).dx = x; when I only have:
The entity
Component name as "velocity"
Property name as "dx"
The target value of dx
Please help, thanks.
The text was updated successfully, but these errors were encountered:
@skypjack Thank you for your quick response, I would like to try entt meta, but I noticed the wiki doesn’t clearly explain how to access components for a specific entity. Currently, I can set component properties using code like this:
registry.emplace<velocity>(entity, 0);
entt::meta_factory<velocity>{}.type("velocity"_hs).data<&velocity::dx>("dx"_hs);
auto type = entt::resolve("velocity"_hs); // replaced by string
auto prop = type.data("dx"_hs); // replaced by string
auto velocityComponent = registry.get<velocity>(entity); // how to replace by "velocity"
prop.set(velocityComponent, propertyValue); // set dx to a given value
How to get velocityComponent from a given entity by string? I’d greatly appreciate your help.
As an EnTT beginner, I want to dynamically set component properties using strings. For example, how can I set
registry.get<velocity>(entity).dx = x;
when I only have:The entity
Component name as "velocity"
Property name as "dx"
The target value of dx
Please help, thanks.
The text was updated successfully, but these errors were encountered: