Splitscreen Node Problems

Hello,
I am currently thinking about creating a splitscreen Mode for my Game.
The Problem is that a node can not have multiple parents.
So I want to know what is the best way to keep the RootNode of the second Player
synchronized with the RootNode of Player 1 ?
When I just clone the node at the beginning of my game I get about 180 FPS on my Notebook.
When I clone the node in every update the Positions of the Geometries getUpdated but I get just 70-90 FPS.
Ah and another Question if I clone a node containing a spatial with animation will the clone contain the animation ?
I also tried:

public void synchronizeWorld(Node node){
for(int i=0;i<node.getQuantity();i++){
node.getChild(i).setLocalTranslation(worldNode.getChild(i).getLocalTranslation());
node.getChild(i).setLocalRotation(worldNode.getChild(i).getLocalRotation());
}
}

With this code I get about 110 FPS. Is that good for my purpose ? But how do I synchronize the animations then ?

I hope you can understand my Problem,
j4ever

Is their a particular reason why you would like to display two distinctly separate rootNodes instead of just looking at the same one

when you create your second viewport you can just simply attach the current rootNode being used to the viewport in order to display your screen something like

[java]
//set original cam to half of the screen vertically
getCam().setViewPort(0.0f,0.5f,0f,1f);

Camera cam2 = getCam().clone();
cam2.setViewPort(0.5f, 1f, 0f, 1f);
ViewPort viewPort2 = renderManager.createMainView(“screen2”, cam2);
viewPort2.setClearFlags(true, true, true);
viewPort2.attachScene(rootNode);
[/java]

for more on this you can check out Multiple Camera Views in the wiki

also to note yes the animation data is carried over during cloning everything is

1 Like

Hey IT WORKS :smiley:
Thanks Bonechilla
I thought it would say me that the world has already an parent.
Thanks for replying :slight_smile: