Jump to content

GetPlayerMouseDirection in syncker.


photo

Recommended Posts

hi

we use syncker with 3 display that defined in diplay.sync file 
when we use (Unigine::getPlayerMouseDirection(p0,p1) in <core/scripts/utils.h> library) the returned direction is not match with the real mouse direction ; why?
my example code is here

example code_test::

    Node mousePointer;

    int udp_port = 8890;
    int tcp_port = 8891;
    int tcp_ping_port = 8892;
    string Broadcast_address = "127.0.0.255";

    SynckerInterface syncker;
    MasterInterface master;
    SlaveInterface slave;

    int init() {
        if(engine.syncker.getArgIsMaster())
        {
            master = engine.syncker.initMaster(Broadcast_address, udp_port, tcp_port, tcp_ping_port, SYNCKER_COMPRESS_QUALITY_HIGH);
            syncker = engine.syncker.getSyncker();
            syncker.setDebug(1, 10, 10,  GUI_ALIGN_BOTTOM | GUI_ALIGN_RIGHT);
        }
        else
        {
            slave = engine.syncker.initSlave("slaveName", udp_port, tcp_port, tcp_ping_port, SYNCKER_COMPRESS_QUALITY_HIGH);
            syncker = engine.syncker.getSyncker();
            syncker.setDebug(1, 10, 10,  GUI_ALIGN_BOTTOM | GUI_ALIGN_RIGHT);
        }

        mousePointer = new NodeReference("Sphere.node");

        Player player = new PlayerSpectator();
        player.setPosition(Vec3(0.0f,-3.401f,1.5f));
        player.setDirection(Vec3(0.0f,1.0f,-0.4f));
        player.setControlled(0);
        engine.game.setPlayer(player);

        return 1;
    }
    
    int update() {

        Vec3 p0,p1;
        Unigine::getPlayerMouseDirection(p0,p1);
        mousePointer.setDirection(vec3(normalize(p1-p0)));

        mousePointer.setPosition(p0 + vec3(normalize(p1-p0)));

        return 1;        
    }
    
    
 

Link to comment

Hello Mahasan,

as we mentioned earlier, getPlayerMouseDirection method doesn't work with multiscreen setups. 

However, this task is achievable, but only with C++ API. You can modify syncker plugin source code or write your own plugin that will catch screen modifications made by syncker.

Thank you!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...