lethil
07-04-2011, 04:03 AM
Howdy!
I'm so close to having my basic control scheme set up for my proof of concept, but I've run into an issue. All local players should share the same camera instance.
Currently, Player 1's camera is what shows on the screen, but each PlayerController has their own camera. The problem with that is that player movement is relative to the camera, so each player is not moving consistently.
I attempted to fix this by creating a camera variable in my GameInfo and set each player to that camera, but they still don't seem to share the same camera.
Here's the code for my attempt:
class DareGame extends UDKGame
config(Game);
var DarePlayerCamera DareCam;
event PostLogin( PlayerController NewPlayer )
{
super.PostLogin(NewPlayer);
NewPlayer.ClientMessage("You're logged in as: "$NewPlayer.PlayerReplicationInfo.PlayerName);
}
event PlayerController Login(string Portal, string Options, const UniqueNetID UniqueID, out string ErrorMessage)
{
local PlayerController PC;
PC = super.Login(Portal, Options, UniqueID, ErrorMessage);
PC.PlayerCamera = DareCam;
ChangeName(PC, "DarePlayer", true);
if ( bDelayedStart )
{
PC.ServerRestartPlayer();
}
return PC;
}
event InitGame (string Options, out string ErrorMessage)
{
DareCam = Spawn(class'Dare.DarePlayerCamera');
super.InitGame(Options, ErrorMessage);
}
defaultproperties
{
PlayerControllerClass=class'Dare.DarePlayerControl ler'
DefaultPawnClass=class'Dare.DarePawn'
bDelayedStart=false
bRestartLevel=false
}
As always, any help would be appreciated!
Jason
I'm so close to having my basic control scheme set up for my proof of concept, but I've run into an issue. All local players should share the same camera instance.
Currently, Player 1's camera is what shows on the screen, but each PlayerController has their own camera. The problem with that is that player movement is relative to the camera, so each player is not moving consistently.
I attempted to fix this by creating a camera variable in my GameInfo and set each player to that camera, but they still don't seem to share the same camera.
Here's the code for my attempt:
class DareGame extends UDKGame
config(Game);
var DarePlayerCamera DareCam;
event PostLogin( PlayerController NewPlayer )
{
super.PostLogin(NewPlayer);
NewPlayer.ClientMessage("You're logged in as: "$NewPlayer.PlayerReplicationInfo.PlayerName);
}
event PlayerController Login(string Portal, string Options, const UniqueNetID UniqueID, out string ErrorMessage)
{
local PlayerController PC;
PC = super.Login(Portal, Options, UniqueID, ErrorMessage);
PC.PlayerCamera = DareCam;
ChangeName(PC, "DarePlayer", true);
if ( bDelayedStart )
{
PC.ServerRestartPlayer();
}
return PC;
}
event InitGame (string Options, out string ErrorMessage)
{
DareCam = Spawn(class'Dare.DarePlayerCamera');
super.InitGame(Options, ErrorMessage);
}
defaultproperties
{
PlayerControllerClass=class'Dare.DarePlayerControl ler'
DefaultPawnClass=class'Dare.DarePawn'
bDelayedStart=false
bRestartLevel=false
}
As always, any help would be appreciated!
Jason