Multiplayer, rotating character on other client

Hi,



I’m making a multiplayer game. The clients are sending their info about the location, viewdirection and walkdirection of the character to all the other clients, when a client receives this info from another client it makes a new character node for this player. But now I’m having trouble to rotate the character node. I tried with the putting the viewDirection in the lookat but it isn’t really working… somebody has any idea?



[java]public class MultiPlayer {



private Main gamePointer = Globals.getGamePointer();

private long playerId;

private Node model;

private AnimChannel animationChannel;

private AnimControl animationControl;



public MultiPlayer(long playerId, int modelId, float[] dBLastPos) {

Logger.getLogger(Main.class.getName()).log(Level.INFO, "toevoegen van nieuwe speler: ", playerId);

//Logger.getLogger(Main.class.getName()).log(Level.INFO, "met positie: ", Pos[0] + Pos[1] + Pos[2]);

this.playerId = playerId;

model = (Node) gamePointer.getAssetManager().loadModel(XMLHandler.getChar(–modelId));

model.setLocalScale(0.2f);

model.setLocalTranslation(new Vector3f(dBLastPos[0], dBLastPos[1], dBLastPos[2]));





gamePointer.enqueue(new Callable() {



public Object call() throws Exception {

gamePointer.getRootNode().attachChild(model);

return null;

}

});



this.animationControl = this.model.getControl(AnimControl.class);

this.animationChannel = this.animationControl.createChannel();

}



public void update(final float[] playerPos, final float[] playerView, float[] playerWalk) {

gamePointer.enqueue(new Callable() {



public Object call() throws Exception {

model.setLocalTranslation(new Vector3f(playerPos[0], playerPos[1], playerPos[2]));

model.lookAt(new Vector3f(playerView[0], 20.5f, playerView[2]), new Vector3f(0, 0, 0));

return null;

}

});

//this.model.setLocalRotation(new Matrix3f(playerView[0], playerView[1], playerView[2]));

}



public void remove() {

gamePointer.enqueue(new Callable() {



public Object call() throws Exception {

gamePointer.getRootNode().detachChild(model);

return null;

}

});

}



public void animate(String string) {

if (string.equals(“Wave”)) {

this.animationChannel.setLoopMode(LoopMode.Cycle);

this.animationChannel.setAnim(string, 1f);

this.animationChannel.setTime(3);

}

if (string.equals(“Walkcycle”)) {

this.animationChannel.setLoopMode(LoopMode.DontLoop);

this.animationChannel.setAnim(string, 0.7f);

}

}

}[/java]

Setting/syncing the correct viewDirection works fine, its what MonkeyZone does too.

It’s also what I do, I only synchronize the aimvector.

set the upVector of lookat to Vector3f.unity. That works always fine as long as the player is standing on the floor(and not on walls ect)



(Why did you set it to 0,0,0 anyway? makes no sense really )