Jump to content

Locking camera controls to mouse movement


photo

Recommended Posts

Posted

Hello,

I can't seem to find a function in the documents or a post on the forum regarding controlling a player/camera via mouse control.

Movement is fine I just cannot seem to find a function regarding setting camera control to mouse movement.

Thanks.

Posted (edited)
3 minutes ago, silent said:

Is there some specific requirements to mouse controls? Could you please give us some additional details about functionality that you are trying to achieve?

Just to mimic the editor style camera in terms of mouse control. I just wish for the camera/player's ViewDirection to be moved with the mouse. i.e: when I move my mouse left the camera also looks left.

Thanks,

Bazarebro

 


    player = PlayerSpectator::create();


    player->setFov(90.0f);
    player->setZNear(0.1f);
    player->setZFar(10000.0f);
    player->setViewDirection(vec3(0.0f, 1.0f, 0.0f));
    player->setPosition(Math::dvec3(-3404.061, -921.754, 535.601));

    player->setMinVelocity(250.0f);
    player->setMaxVelocity(500.0f);

   
    Game::get()->setPlayer(player->getPlayer());
    player->release();
    player->setControlled(0);

 

My current player^

Edited by bazarebro
Posted

to rotate the camera with the mouse you need set

player->setControlled(1);

If you need special camera control, you can see samples UnigineScript/Players,  in c ++ it works the same way.

×
×
  • Create New...