[Solved] -Spawning Objects Problem
by Kenan Chabuk · in Torque 3D Professional · 09/05/2011 (8:29 pm) · 4 replies
For an RTS I'm working on I need to spawn units, obviously. But I am noticing a weird problem.
In singleplayer mode everything works like it should for the spawning of objects. But in dedicated server plus client, when I do a server command to spawn the object sometimes the object will not appear to the client even though the server says it has been created. It seems to almost always be the first command that this happens and then randomly thereafter. The objects are set to ghostable and scopeAlways and like I said sometimes it works so I don't think its a scope problem.
Here is the code to spawn the object in script I am using.
Anyone have a problem similar to this?
In singleplayer mode everything works like it should for the spawning of objects. But in dedicated server plus client, when I do a server command to spawn the object sometimes the object will not appear to the client even though the server says it has been created. It seems to almost always be the first command that this happens and then randomly thereafter. The objects are set to ghostable and scopeAlways and like I said sometimes it works so I don't think its a scope problem.
Here is the code to spawn the object in script I am using.
function serverCmdSpawnUnit(%client)
{
%id = new RTSUnit()
{
position = VectorAdd( PlayerSpawn.position, "0 0 5" );
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "DefaultUnit";
};
MissionCleanup.add(%id);
echo( %id );
}I am also having a problem with ghostIds between server and client and I think the object creation is the root of the problem.Anyone have a problem similar to this?
#3
09/06/2011 (1:59 pm)
Found the problem. After doing more tests I found out the objects were being created on the client also but their positions out of whack. More tests showed my custom class's position and warping code was incorrect. Once that was fixed they spawn correctly.
#4
09/06/2011 (5:40 pm)
Sweet!
Torque Owner Richard Ranft
Roostertail Games