How do I assign one entity within another entitie's component?

Float stores numbers; what stores entitys? I'm mostly looking for the syntax, but I will detail my question.

Say I have the player, built from the default playercomponent.

then I have a second entity, and this one has a unique component. This component needs to store the player's location as a vector 3,
also, this entite's location needs to be stored in another component as well.

what is the c++ syntax for doing so?

I tried: addmember(IEntity* placeholder,"","","", nullptr) within the desc. area of the header, so that I could just drag the entity into the appropriate component. I did not get this to work.

In the case that i'm using the playercontroller, there's no visible entitiy to drag and drop. And further, there are more complex design choices I would like to implement anyways, involving procedural entity generation and management.

So how would I search for specific entities in C++, how would I assign them, and what container is needed to store the entity within a component to be referenced later.

Re: How do I assign one entity within another entitie's component?

In the experimental schematyc (5.6.4 component entities) you don't store the entity pointer, instead you store the entity Id.

Code: Select all

You will need to setup getting the players position, which you can do either in the graph using FindEntityByName or via C++ of course by getting the player entity how you wish (either a static variable/function on the player component or some other means).

To get the IEntity* from a Schematyc::ExplicitEntityId you cast it to an EntityId and then query for the entity using the entity system like so:

Code: Select all

Schematyc::ExplicitEntityId myExplicitId;
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(static_cast<EntityId>(myExplicitId));
You can get components from entities by using the IEntity::GetComponent<Type>() function.
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Who is online

Users browsing this forum: No registered users and 3 guests