瀏覽代碼

lock in spawnLocation at client controllable creation
ensure the initial position of the controller object starts at spawnLocation's position rather than relying solely on settransform to ensure at no point would a controllable touch an origin subscene unintentionally

AzaezelX 2 天之前
父節點
當前提交
1fd55fe23a
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.tscript

+ 3 - 1
Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.tscript

@@ -192,8 +192,10 @@ function GameConnectionListener::onSetSpawnPointComplete( %this, %client )
    %client.GetEventManager().remove( %client.listener, "setSpawnPointFailed" );   
    %client.GetEventManager().remove( %client.listener, "setSpawnPointFailed" );   
    %client.GetEventManager().subscribe( %client.listener, "postSpawnComplete" );
    %client.GetEventManager().subscribe( %client.listener, "postSpawnComplete" );
    
    
+   %client.spawnProperties = "position =\""@ getWords(%client.spawnLocation,0,2) @"\";" @ %client.spawnProperties;
+   
     // Spawn with the engine's Sim::spawnObject() function
     // Spawn with the engine's Sim::spawnObject() function
-    %client.player = spawnObject(%client.spawnClass, %client.spawnDataBlock, %client.spawnProperties, %client.spawnScript);
+    %client.player = spawnObject(%client.spawnClass, %client.spawnDataBlock, "", %client.spawnProperties, %client.spawnScript);
     
     
     if(!isObject(%client.player))
     if(!isObject(%client.player))
        error("Failed to spawn player object!");
        error("Failed to spawn player object!");