Game Development Community

[1.1.0 Beta 1] SpawnSphere::spawnObject

by Phillip O'Shea · in Torque 3D Professional · 03/07/2010 (3:05 pm) · 5 replies

The object created isn't spawned at the location of the SpawnSphere, it is always at (0,0,0).

Suggested Fix:
SimObject* SpawnSphere::spawnObject(String additionalProps)
{
   ...

   // Scene Object?
   SceneObject *sceneObject = dynamic_cast<SceneObject*>( spawnObject );
   if ( sceneObject )
   {
      // Set Position.
      sceneObject->setPosition( getPosition() );
   }

   return spawnObject;
}

About the author

Head of Violent Tulip, a small independent software development company working in Wollongong, Australia. Go to http://www.violent-tulip.com/ to see our latest offerings.


#1
03/07/2010 (3:26 pm)
Phil, have you tried this? linky
#2
03/07/2010 (3:36 pm)
That link was to get SpawnSpheres created in the Editor. This is a fix for the console method SpawnSphere::spawnObject.

When you have a SpawnSphere and all spawnObject, you might expect the newly created object would be positioned at the location of the sphere itself. It isn't, it is created at (0,0,0). The above code just repositions the newly created object at the position of the sphere.
#3
03/07/2010 (5:19 pm)
A-ha, gotcha.

Thanks for the elaboration, I was a bit confused there.
#4
03/07/2010 (7:45 pm)
Phillip,

For those of us that are just learning our way around torquescript where is this code to be place?

Thanks!
#5
03/07/2010 (7:47 pm)
Chris, this is an engine modification and needs to be placed in T3D/missionMarker.cpp.