Esempio n. 1
0
// This is called just after the constructor, when Construct has added details to your
// object such as siblings and type pointer.  If you need this data on startup, it is
// valid to read here.
void ExtObject::OnCreate()
{
	bin ar;
	ar.attach(info.editObject->eData, info.editObject->eSize);

	float fMass;

	int Version = 0;
	ar >> Version;

	ar >> gravity >> fMass >> immovable >> lineardamp >> shape >> angulardamp >> norotation;

	// Default values for older versions
	contactFriction = 0.8f;
	contactElasticity = 0.4f;

	if(Version >= 2)
	{
		ar >> editMode;
		ar >> boolAddingPoints;
		ar >> AddingPointsIndex;
		ar >> AddingPointsCollision;
		int size = m_CompoundCollisions.size();
		ar >> size;
		for(int i = 0; i < size; i++)
		{
			CollisionShape myshape;
			myshape.Serialize(ar);
			m_CompoundCollisions.push_back(myshape);
		}
	}