Jump to content

[2.10+] setSlavePlayer can no longer use a player defined in an IG entity


photo

Recommended Posts

Hello,

In 2.9, when a CIGI entity was created, we used to parse its content to find any embedded player camera and store them in a container. The user could then iterate through this container and call 

Game::setPlayer(camera);
// or
master->setSlavePlayer(mask, camera);

to force the view either on the master or on some specific slaves.

Alternatively, we could also dynamically add new nodes to some part of the entity, using node->setParent(<a subnode in the entity>) and syncker->createNode(node).

In 2.10, these no longer works on the slaves, as they report:

15:25:45 Slave::read_tcp_node_id_register(): bad possessor node id 1708906218
15:25:45 2:
15:25:45 0:
15:25:45 0:
15:25:45 2014064087:

In the hierarchical debug view, I note that the nodes in an entity are no longer yellow (probably because now the Syncker is no longer used to sync the ig master/slave, I guess)

Do we need to change/add something?

(note: we don't really need to set the 'real' camera in the entity as the current player, we could also create a new camera and just 'place it' where the entity camera is, but this produces a lot of jitter in our test).

Thanks!

Link to comment

Hello!

On 6/12/2020 at 8:43 PM, Amerio.Stephane said:

In the hierarchical debug view, I note that the nodes in an entity are no longer yellow (probably because now the Syncker is no longer used to sync the ig master/slave, I guess)

Yes it is. there are some difficulties because of this.
Syncker does not know about entities. so that the camera does not shake relative to the entity, you need to use the view class.

auto view = ig->getView(0);
view->setParentEntity(entity)
view->setPosition(entity_relative_position_of_player);
..
ig->setPlayer(0);

to install a separate camera on slave you will have to use the method master->setSlavePlayer(index, camera);

Link to comment

Sorry, I can't get it to work. Can I get a working code sample?

Let's say my Entity has two embedded players, playerA and playerB. I understand how I set the master to look through one of these, but how do I set my slave A to look through playerA and slave B to look through playerB (or, how do I create a view/player for each to achieve similar results).

Thanks!

Link to comment
×
×
  • Create New...