Game Development Community

.dif Dynamic Placement

by Sky Frostenson · in Torque Game Engine · 02/16/2005 (2:50 pm) · 6 replies

I am looking to dynamically place .dif building files at runtime. That
is, I want to be able to place buildings as I am running around the world
(without using the mission editor). Has anyone done something similiar or
know how to go about doing so?

Thanks.

#1
02/16/2005 (3:14 pm)
It's easy to place buildings using the World Editor (and you're running around the map), or are you talking about creating buildings like with the Cube Engine?
#2
02/16/2005 (8:03 pm)
You can create a new interior object the same way you create any other object
%newCell = new InteriorInstance() {
	interiorFile = "~/data/interiors/whatever.dif";
};

The only problem is they will be all black. Unless you place them when the map is loaded before the re-light process like i'm doing for my rpg.
#3
02/16/2005 (8:53 pm)
The interiors will only be black if you do not use Quark lights. I made an interior with lights around the outside of the dif, and it was lit up without having to do a full relight. The only thing missing was the shadow on the terrain.

There was a problem when I did this a long time ago (it may have been fixed). The textures weren't being loaded properly, and I found a line somewhere in the code that only loaded (or something) the textures if the mission editor was running. There's a code block that starts with if(gEditingMission) { ... but there are probably at least a few of those. All I did was make that code execute whether editing the mission or not, and it worked.
#4
02/17/2005 (12:49 pm)
Thanks for the replies.

Once I've created the InteriorInstance (as above), how do I go about placing it in the game world? I saw that there is a setPosition function in the SceneObject.cc, but I wasn't sure how to access this. Plus, it takes a Point3f, and I wasn't sure how to create that.

Thanks again for any help.
#5
02/19/2005 (4:28 pm)
Set the position when you create it. ie,

%newCell = new InteriorInstance() {
   interiorFile = "~/data/interiors/whatever.dif";
   position = "2 3 4";
}
#6
03/02/2006 (9:17 am)
Is possible to unload or remove the interior as well?