In version 1.8 SetPosition does not work for the transport class, for all other types it works.
// create a global variable
Object m_SpawnedObject = NULL;
1.create transport
vector posSpawn = Vector(1161.617432, 6.139075, 2399.965820);
m_SpawnedObject = GetGame().CreateObjectEx( "OffroadHatchback", posSpawn, ECE_PLACE_ON_SURFACE );
EntityAI MyCar = EntityAI.Cast(m_SpawnedObject);
if (MyCar)
{
MyCar.GetInventory().CreateAttachment("HatchbackWheel");
MyCar.GetInventory().CreateAttachment("HatchbackWheel");
MyCar.GetInventory().CreateAttachment("HatchbackWheel");
MyCar.GetInventory().CreateAttachment("HatchbackWheel");
MyCar.GetInventory().CreateAttachment("HatchbackDoors_Driver");
MyCar.GetInventory().CreateAttachment("HatchbackDoors_CoDriver");
MyCar.GetInventory().CreateAttachment("HatchbackHood");
MyCar.GetInventory().CreateAttachment("HatchbackTrunk");
MyCar.GetInventory().CreateAttachment("SparkPlug");
MyCar.GetInventory().CreateAttachment("SparkPlug");
MyCar.GetInventory().CreateAttachment("EngineBelt");
MyCar.GetInventory().CreateAttachment("CarBattery");
MyCar.GetInventory().CreateAttachment("CarRadiator");
MyCar.GetInventory().CreateAttachment("HeadlightH7");
MyCar.GetInventory().CreateAttachment("HeadlightH7");
MyCar.GetInventory().CreateInInventory("TireRepairKit");
MyCar.GetInventory().CreateInInventory("TireRepairKit");
vector PosTP1 = Vector(5000,0,5000);
PosTP1[1] = GetGame().SurfaceY(PosTP1[0],PosTP1[2]);
MyCar.SetPosition(PosTP1); no teleportation
}
- we execute setpos separately from the spawn
if (m_SpawnedObject)
{
vector PosTP1 = Vector(5000,0,5000);
PosTP1[1] = GetGame().SurfaceY(PosTP1[0],PosTP1[2]);
m_SpawnedObject.SetPosition(PosTP1); // no teleportation
}