Jump to content

[SOLVED] PlayerPersecutor setFixed() doesn't do anything.


photo

Recommended Posts

So I have tried using the setFixed(0) and setFixed(1) on PlayerPersecutor and it returned no useful result. I still can rotate my camera outside of editor mode.

 

Any fixed on this?

 

 

Link to comment

Ok.. I kinda got it. SetFixed() make the camera rotate along when its player node rotate. However, how I need to disable the camera from rotating with the mouse movement. How do I do that?

 

ps. Doesn't want to use setTurning(0) either. Want to disable it completely to save cpu cost. (I still have no clue what setTurning() does though. I can still rotate both the player and the camera around with 0 value.)

Link to comment

However, how I need to disable the camera from rotating with the mouse movement. How do I do that?

 

If I understand you correctly - try to use player.setControls() function.

https://developer.unigine.com/en/docs/1.0/scripting/library/players/class.player#setControls_Controls

 

Using this function with "null" argument - "setControls(NULL)" - disables camera movements with the mouse outside the editor.

 

 

 

 

how do I release the mouse cursor's position from sticking to the PlayerPersecutor's target node?

 

Please, describe in details what do you want to do.

Link to comment

"player.setControls(NULL)" worked perfectly, thank you.

 

We are trying to get the mouse cursor to move away from the PlayerPersecutor's Anchor position. However, it keep blinking back to the middle of the screen....

Link to comment

Wait a minute... a major confusion. So player.setControls() only assigns the control type to the world. Where and how is the camera getting controlled by it though,,,

Link to comment

We are trying to get the mouse cursor to move away from the PlayerPersecutor's Anchor position. However, it keep blinking back to the middle of the screen....

 

I'm afraid we need a test scene to find out what's happening

Link to comment

Wait a minute... a major confusion. So player.setControls() only assigns the control type to the world. Where and how is the camera getting controlled by it though,,,

Please, use the documentation.

https://developer.unigine.com/en/docs/1.0/scripting/library/controls/class.controls and inherited classes - ControlsApp Class, ControlsDummy Class, etc.

 

Engine.contols stores all of your input.

If you want to process only particular input you can use ControlsDummmy instead of engine.controls.




/*
*/
ControlsDummy controls;

/*
*/
void init() {

     controls = new ControlsDummy();

     // By default player persecutor is controlled by engine.controls
     PlayerPersecutor player = new PlayerPersecutor();

     // Let it be controlled by our custom controls instead.
     player.setControls(controls);

     // ...
}

/*
*/
void update() {

     // You can set input to controls dummy according to global input,
     // though you can process the input the way you want to.
     controls.setMouseDX(engine.controls.getMouseDX());
     controls.setMouseDY(engine.controls.getMouseDY());
}
Link to comment
×
×
  • Create New...