bw logo

Chapter 4. Saving/loading the SkeletonCollider

Table of Contents

4.1. Saving
4.2. Loading

4.1. Saving

The SkeletonCollider can be saved to a DataSection by using the save method. The following python code will create a new xml section called creature_skeleton.xml in the folder data and save the SkeletonCollider to it.

import ResMgr
ds=ResMgr.openSection('data/creature_skeleton.xml',True)
creature.skeletonCollider.save(ds)
ds.save()

4.2. Loading

The SkeletonCollider can be loaded from a DataSection by using the load method. After loading the SkeletonCollider, the colliders need to be attached to the appropriate nodes in the model. This is why it is important to name your BoxAttachments using the actual node names from the model.

import ResMgr
ds=ResMgr.openSection('data/creature_skeleton.xml')

# Create and load the SkeletonCollider
creature.skeletonCollider=BigWorld.SkeletonCollider()
creature.skeletonCollider.load(ds)

# Attach the collider objects to the model
for i in range(0,creature.skeletonCollider.nColliders()):
  collider=creature.skeletonCollider.getCollider(i)
  creature.model.node(collider.name).attach(collider)