Пример #1
0
ramPyramidPrimitive::ramPyramidPrimitive(const ofMatrix4x4& mat, float size)
{
	size *= 0.5;

	mesh.addVertex(ofVec3f(1, 1, 1) * size);
	mesh.addVertex(ofVec3f(-1, 1, -1) * size);
	mesh.addVertex(ofVec3f(-1, -1, 1) * size);
	mesh.addVertex(ofVec3f(1, -1, -1) * size);

	mesh.addTriangle(0, 1, 2);
	mesh.addTriangle(0, 2, 3);
	mesh.addTriangle(0, 3, 1);
	mesh.addTriangle(3, 2, 1);

	body = getWorld().addMesh(mesh, mat.getTranslation(), mat.getRotate().getEuler());
}
Пример #2
0
void ofQuaternion::set(const ofMatrix4x4& matrix) {
	*this = matrix.getRotate();
}
Пример #3
0
ramBoxPrimitive::ramBoxPrimitive(const ofMatrix4x4& mat, const ofVec3f& size)
{
	body = getWorld().addBox(size, mat.getTranslation(), mat.getRotate().getEuler());
}
Пример #4
0
ramCylinderPrimitive::ramCylinderPrimitive(const ofMatrix4x4& mat, float radius, float height)
{
	body = getWorld().addCylinder(radius, height * 0.5, mat.getTranslation(), mat.getRotate().getEuler());
}