Game Development Community

Player Start Position

by KK (starcave) · in Torque Game Engine · 07/27/2004 (2:11 am) · 6 replies

Quick question...

Could anyone point me in the right direction as to how i define a player start position?
At the moment, mt player falls about 200 feet out of the sky...

Thanks Guys.

#1
07/27/2004 (3:42 am)
You can place SpawnPoints in the Editor.
In the Creator you have to pick "Spawn Shere Marker" or something like this.
Place it where you would like to spawn to player. You can also set more than one point on your map. At respawn a random Spawnpoint will be taken.
#2
07/27/2004 (4:15 am)
I think the demo's code, by default, looks for the SimGroup named PlayerDropPoint, which should contains the Spawn Sphere that Marco is describing.
#3
07/28/2004 (1:56 pm)
I still cant get it to work! It is doing my head in! I cant find it in the documentation either. Nor in the 3d Game Progamming all in 1 book.

I tried everything you guys have said above, and nothing..

Any one know exactly what to do? or where in the documentation it is?

Cheers
#4
07/28/2004 (2:25 pm)
At line 322 in Game.cs you'll find this function....


function pickSpawnPoint() 
{
   %groupName = "MissionGroup/PlayerDropPoints";
   %group = nameToID(%groupName);

   if (%group != -1) {
      %count = %group.getCount();
      if (%count != 0) {
         %index = getRandom(%count-1);
         %spawn = %group.getObject(%index);
         return %spawn.getTransform();
      }
      else
         error("No spawn points found in " @ %groupName);
   }
   else
      error("Missing spawn points group " @ %groupName);

   // Could be no spawn points, in which case we'll stick the
   // player at the center of the world.
   return "0 0 300 1 0 0 0";
}

You are actually falling 300 meters out of the air as you can see. The problem is not in your code, it is in your map. If your code is different than this, I'll need to see it. Make sure you have a group called "PlayerDropPoints" in your missiongroup and in that group place a marker in the place you want to spawn. Make sure it's centerline is above the ground or you'll fall through the map.
#5
07/29/2004 (10:29 am)
Thanks for your reply,

The code I have in Game.cs is the same as above yes.
Il try put in a marker but what type of marker do i use? Does it need any values or tags or anything like that?

Cheers,

Phil
#6
07/29/2004 (11:30 am)
That code does not care what the marker is exactly. You could put a car in that group and the transform of the car would be your spawn point. Just place a mission marker(into that group) anywhere on the map where you want to spawn and you should spawn there the next time you run the map. The standard values that come with the marker are all you need to spawn. The above function only needs to know where that marker is to use it. If you put 10 markers on your map(all in the same group) then you would begin to randomly spawn in defferent spots using those 10 markers....


here's a spawnsphere set up to spawn you just outside the buildings on the demo map stronghold...

new SpawnSphere() {
            position = "413.558 308.808 218.983";
            rotation = "0 0 -1 87.6625";
            scale = "1 1 1";
            dataBlock = "SpawnSphereMarker";
            radius = "1";
         };


By using a radius of "1" you will spawn right on top of that sphere every time. If you increased it to say 100 then you would spawn randomly inside the 100 meter radius of the sphere. Which depending on your terrain could be above or below it as well.