Author Topic: direction player and camera  (Read 153 times)

crom M   «   on: July 18, 2012, 11:04:01 AM »
hi,

i test http://wiki.flare3d.com/index.php/Test09_-_Lights_and_Collisions

i have question,
my camera is good but when i press W
if ( Input3D.keyDown( Input3D.W ) ) player.translateZ( playerVel );my player translation don't follow camera vue
it's translate axe Z

what's the solution ?

best regards


Ivan Vodopiviz   «   Reply #1 on: July 18, 2012, 11:27:00 AM »
If you check the example, the player is set as the camera "parent", so if the player moves, the camera will follow. Something like this:

scene.camera.parent = player;

Hope this helps,

crom M   «   Reply #2 on: July 18, 2012, 12:04:51 PM »
yes but it's not work

// creates and parents the camera to the player.
            scene.camera = new Camera3D( "ourCamera" );
            scene.camera.y = 20;
            scene.camera.parent = player;