I'd recommend making a separate folder to work on the files, place both the WCEditor_v1_2a.py and WClib_v1_2.py files in that folder together with a copy of the .worldcollision file you want to work on.
You launch the editor by double clicking or 'opening' with python, the WCEditor_v1_2.py file. A black dos box will come up first and then the menu interface.
click the "read binary .worldcollision file" button to load a file. While you're doing that it's worth getting in the habit of moving the dos box so you can view the contents, if you hit an error opening or saving a file that's where the information will show up....
Once you've got a file loaded if you go to the Central Entries section and open one of the Entry's and one of it's Groups, if you double click on the 'Large Table' entry it will generate a mayavi2 view of the collision volume.
The volume pictured is the damaged version of a small part of roof, it's likely that this volume is in use for multiple objects. If you inspect other collision volumes you’ll find most of them are smaller items than this – some are just squares made up of two triangle representing a 2m x 2m approx piece of wall in the game, some of the settlement buildings can be made up of 100’s of different small objects each with their own instance of a collision entry.
****************************************************
Changing an Existing Collision Entry
To try to pick on a relatively easy example which will have an obvious noticeable effect in the game – try altering the collision volume for a simple type of tower. (one which doesn’t have a damage transition animation – or you’ll get some odd effects when it tries to apply the animation)
Central Entry 16 – group0 in Stone Fort C is the undamaged entry for the top of a small square tower – for the basic arrow slot version (there’s two upgrades to these towers for the higher fortification levels and the upgrades use different collision entries!)
Select the large table for that group, and view the mayavi diagram to make sure it’s the right one, then click the ‘save scratch file’ option. The resulting ms3d file will be saved as “WCeditorscratchfile.ms3d”.
Open that file with milkshape and make some obvious alterations.
Here I’ve raised the top section of the tower 8m in milkshape, and duplicated the square bottom sections to fill in the gap that would be left below – I’ve then regrouped everything into one group (collision volumes need to be only one group). Inspect the ‘model statistics’ and note the number of triangles now in the model. Also note that the ms3d model for the collision volume is positioned relative to the 0,0,0 axis and not located at x=-100, y=-60 or where-ever the .world object appears in the game. This is due to the way CA re-use the same volume for different objects, they set the collision volume at 0,0,0 and then move each different instance of it to match up with the object location by using the rotation and co-ordinate positions for each object in Table Three.
Save the revised ms3d using the same “WCeditorscratchfile.ms3d” name. With the relevent large table entry selected again, click the ‘load scratch file’ option – the mayavi view should now look like your revised shape (don’t worry if it looks mangled initially) Click ‘save changes to memory’, if your model looked mangled initially double click the large table entry again and you should find the view has sorted itself out… If you changed the number of triangles in the model you should also change the small table entry, though there seems to be some latitude you can get away with on that – currently changing the small table rows of a multi row small table needs to be done via text rep, as we don't currently understand the set up of multi-row small tables I'd recommend using simple single row small tables for anything new you're adding....
To make it more obvious where collision volume was I also scaled it up x2. Here’s result:
unfortunately it’s quite hard to screen shot but if you hover cursor over area near tower it now shows as being ‘tower’ and when a missile strikes it strikes the enlarged tower area.
****************************************************
Removing a Collision Object
If you've hidden an existing object and want to get rid of its collision effects (so that missiles don't collide with a now invisible object!) You can achieve that simply by changing the Table Entry it uses in Table Three of the .worldcollision file to -1 (eg so it doesn't use a collision entry)
You need to know the object number of the thing you've changed. To find that load the .world file in the _09 version of the WorldEditor. View the list near the bottom of the
file_name_nomodeldata.txt file that is automatically generated in a sub-folder of the folder your .world file is in. You'll see list like:
Code:
=============
Complex 17
=============
Complex 17, Structure: 1, Group: 1 Independent. Object no. 518
Complex 17, Structure: 1, Group: 2 Independent. Object no. 519
Complex 17, Structure: 1, Group: 3 First of a pair. Object no. 520
Complex 17, Structure: 1, Group: 4 Second of a pair.
Complex 17, Structure: 1, Group: 5 Independent. Object no. 521
Complex 17, Structure: 2, Group: 1 First of a pair. Object no. 522
Complex 17, Structure: 2, Group: 2 Second of a pair.
Complex 17, Structure: 2, Group: 3 First of a pair. Object no. 523
Complex 17, Structure: 2, Group: 4 Second of a pair.
Complex 17, Structure: 1, Group: 6 First of a pair. Object no. 524
Complex 17, Structure: 1, Group: 7 Second of a pair.
The complex structure and group numbering ties up with the milkshape files the editor produces so if you've changed Complex 17, Structure 2 Groups 1 & 2, you'll see they make up Object no 522 in this example.
To disable that objects collision entry load the equivalent .worldcollision file in WCEditor_v1_2, in the main tab expand +Table Three, and double click on the entry for object 522, you'll get screen like:
to disable that object from having a collision entry just change whatever it says in first box for 'Entry Used'
to -1
Press 'Save' on that screen then go back to 'Main' tab and select 'Write Binary .worldcollision File'
to get a revised file.
****************************************************
Collision Volume Location and Orientation
As already stated CA frequently use one collision volume (eg. one Central Entry section) for a variety of similar objects, eg; objects that are the same shape but appear in different locations and in different orientations. Thus they normally have the model for the collision volume centred at 0,0,0 on the x,y,z axis when you view an example in milkshape.
As an example the complex six group collision object for a piece of wall that can be demolished is in Central Entry number 65 in stone_fort_C's collision file, the three breakable wall objects 153, 257 and 626 from stone_fort_C's .world file all use that same Central Entry no 65. Their table three entries are:
Code:
65 153 +0.0000003139 +0.0000000000 -0.9999999404 +52.5616798401 +0.0000003139 +0.0000000000 +1.0000000000 -27.3374595642
+0.0000000000 +1.0000000000 +0.0000000000 +12.6244945526 +0.0000000000 +1.0000000000 +0.0000000000 -12.6244945526
+0.9999999404 +0.0000000000 +0.0000003139 +27.3374404907 -1.0000000000 +0.0000000000 +0.0000003139 +52.5616760254
+0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 +52.7671394348 +13.0917243958 +26.9950160980 +13.6092519760
65 257 +1.0000000000 +0.0000000000 +0.0000000000 -33.9383888245 +1.0000000000 +0.0000000000 +0.0000000000 +33.9383888245
+0.0000000000 +1.0000000000 +0.0000000000 +0.5697202682 +0.0000000000 +1.0000000000 +0.0000000000 -0.5697202682
+0.0000000000 +0.0000000000 +1.0000000000 -35.1630630493 +0.0000000000 +0.0000000000 +1.0000000000 +35.1630630493
+0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 -34.2808113098 +1.0369502306 -35.3685226440 +13.6092519760
65 626 -0.0000000437 +0.0000000000 +1.0000000000 -60.4378356934 -0.0000000437 +0.0000000000 -1.0000000000 -4.6633787155
+0.0000000000 +1.0000000000 +0.0000000000 +8.5682640076 +0.0000000000 +1.0000000000 +0.0000000000 -8.5682640076
-1.0000000000 +0.0000000000 -0.0000000437 -4.6633758545 +1.0000000000 +0.0000000000 -0.0000000437 +60.4378356934
+0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 -60.6432952881 +9.0354938507 -4.3209514618 +13.6092519760
The version of the collision volume used for object 257 is in the same orientation as the model produced by the coordinates in Central Entry 65 the others are turned 90 degrees and 270 degrees approximately, the way the orientation stuff works seems to be related to this sort of system....
http://www.euclideanspace.com/maths/...ples/index.htm
a better explanation but not in English can be found here
http://spanusoft.altervista.org/Pipe..._rotazione.htm
that was used by johnwhile to make very handy excel sheet to calculate required values see:
http://www.twcenter.net/forums/showt...07#post6504307
For final collision object position with same orientation as the collision model you need a table three format like:
+1.0000000000 +0.0000000000 +0.0000000000 (difference x value)
+0.0000000000 +1.0000000000 +0.0000000000 (difference y value )
+0.0000000000 +0.0000000000 +1.0000000000 (difference z value )
+0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000
for the first section and:
+1.0000000000 +0.0000000000 +0.0000000000 -(difference x value)
+0.0000000000 +1.0000000000 +0.0000000000 -(difference y value )
+0.0000000000 +0.0000000000 +1.0000000000 -(difference z value )
+0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000
for the second part - the 'difference' part means the difference between the coordinate position of the centre of the model used for the collision entry and the coordinate position of the centre of where you actually want it to turn up in the game (eg at the centre of the object that's using it).
if you depart from CA's method and don't re-use Central Entry's for multiple objects, you can with the WCEditor just load your object model (at its actual desired location and not centred on 0,0,0) that then means you don't need to give relocation figures in table three.... so the entry for a collision volume to appear at same place as it's .ms3d coordinates looks like:
Code:
(entry) (object) +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 (x of bounding sphere centre) (y of sphere) (z of sphere) (radius)
that limits the complexity involved in getting things in the right place, but would end up making larger files if you need new collision entries for a lot of objects that could have shared.
The IWTE tool automatically moves your object co-ordinates to centre on 0,0,0 and calculates the displacement, but it doesn't handle rotations.