Jump to content

Recommended Posts

Hi all,

I'm struggling a little here. I've no doubt locality is what's doing for me here, but after a day of messing with this, I'm here, out of ideas.
In multiplayer, each client can only see their own camera feed. They can't see anyone elses.

server: blubasescreen is the tri-screen computer Land_MultiScreenComputer_01_black_F

blubasescreen setObjectTextureGlobal [1, "#(argb,512,512,1)r2t(alpha_1,1.0)"];
blubasescreen setObjectTextureGlobal [2, "#(argb,512,512,1)r2t(alpha_2,1.0)"];

["client\helmetcam.sqf"] remoteExec ["execVM", 0, true];
_myscript = "helmetcam";

{
    _cam = "camera" camCreate [0,0,0];
    _cam setVectorDir (eyeDirection player);
    _cam cameraEffect ["INTERNAL", "BACK", (str player)];
    _cam camSetFov 0.6;
    _cam attachTo [player, [0.10,0,0.17], "Head", true];
    _cam camCommit 0;
} forEach (allPlayers select {((toLower(headgear _x)) find "helmet") isNotEqualTo -1});

helmetcam make the camera locally on each player and names the rtt. But how does the rtt get from the cameraEffect command on the client to the setObjectTextureGlobal command on the server? Must each rtt be a unique name on the network?

 

Thanks everyone

Share this post


Link to post
Share on other sites

I've made no progress.
Any help?

Share this post


Link to post
Share on other sites

You could try:

{
  private _cam = "camera" camCreate [0,0,0];
  _cam setVectorDir (eyeDirection _x);
 systemChat str _x;   // just verify it's same with your r2t in setObjectTextureGlobal
  _cam cameraEffect ["INTERNAL", "BACK", str _x];
  _cam camSetFov 0.6;
  _cam attachTo [_x, [0.10,0,0.17], "Head", true];
  _cam camCommit 0;
} forEach (allPlayers select {((toLower(headgear _x)) find "helmet") isNotEqualTo -1});

 

Remark:

If executed from an object's init field (which should not be done anyway for GEGlobal commands), execution may happen too early and fail to broadcast over the network and to be JIP compatible.

So place just one line of setObjectTextureGlobal (1,2 or 3th texture) inside some initPlayerLocal.sqf of (max 3) players.

Example:

in initPlayerLocal.sqf:

if (player == bob) then {blubasescreen setObjectTextureGlobal [2, "#(argb,512,512,1)r2t(bob,1.0)"];

or use the player's ID see getPlayerUID

  • Like 1

Share this post


Link to post
Share on other sites
On 3/18/2023 at 8:11 PM, Tankbuster said:

_myscript = "helmetcam";

{
    _cam = "camera" camCreate [0,0,0];
    _cam setVectorDir (eyeDirection player);
    _cam cameraEffect ["INTERNAL", "BACK", (str player)];
    _cam camSetFov 0.6;
    _cam attachTo [player, [0.10,0,0.17], "Head", true];
    _cam camCommit 0;
} forEach (allPlayers select {((toLower(headgear _x)) find "helmet") isNotEqualTo -1});

 

 

Maybe I'm not seeing the forest for the trees but you're iterating over players with helmets and create cameras for each of those players but you are attaching all of the cameras to the head of the same player object, the player object local to each client, hence clients can only see themselves.
Should it not be this?
 

_cam attachTo [_x, [0.10,0,0.17], "Head", true];

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 5/28/2023 at 3:20 PM, mrcurry said:

 

Maybe I'm not seeing the forest for the trees but you're iterating over players with helmets and create cameras for each of those players but you are attaching all of the cameras to the head of the same player object, the player object local to each client, hence clients can only see themselves.
Should it not be this?
 


_cam attachTo [_x, [0.10,0,0.17], "Head", true];

 

Oh... I'm so annoyed with myself! Yes, thank you, that was what was wrong. Schoolboy error! It works!

  • Like 1

Share this post


Link to post
Share on other sites

Hope this makes sense. 🙂 Note to self, don't test stuff like this in a server with AI that are likely to mortar you at any time! 🙂

  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, Tankbuster said:

Hope this makes sense. 🙂 Note to self, don't test stuff like this in a server with AI that are likely to mortar you at any time! 🙂

Nice! To get rid of the jerky motion you can try using getCameraViewDirection instead since it works in render-time. Edit: Nevermind... it was my turn to be an idiot... You are using attachTo to track the motion...

  • Like 1

Share this post


Link to post
Share on other sites

Thank you to you and Pierre.

Making my pseudo code into real code!

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×