ViewDirection CharacterControl

Hi all.

When my game wasn’t online, I used cam.getLocation().add(cam.getDirection().normalize().mult(0.5f + bomb.getRadius())); for display a new bomb front of the player, but there “cam” has sense.

In a multiplayer game, cam has no sense, so can I use characterControl.getViewDirection???

cam.getDirection == characterControl.getViewDirection ???

thanks :slight_smile:

Well, I’ve used something to make a character walk around and having the camera follow it. The controls are WASD where w and s are for moving forward and backward and s and d are for turning around the character. To get the direction in which the character is pointing I’ve used this function:


full code of what I mean is this:


walkDirection.set(0, 0, 0);

Vector3f camDir = playerNode.getLocalRotation().getRotationColumn(2).clone().mult(0.3f);

if (left) { playerNode.rotate(0,0.02f,0) ;}

if (right) { playerNode.rotate(0,-0.02f,0) ;}

if (up) { walkDirection.addLocal(camDir.negate()); }

if (down) { walkDirection.addLocal(camDir); }



This is based on the default first person code.

So I hope you can use the same function to get the direction based on the character.

Greetz Ertyui