コード例 #1
0
Matrix PhysicsGeom::getTransformation(void) const
{
    Matrix Transformation;
    
    Vec3f Translation;
    const dReal* t = dGeomGetOffsetPosition(_GeomID);
    Translation.setValues( t[0],t[1],t[2] );

    dQuaternion q;
    dGeomGetOffsetQuaternion(_GeomID, q);
    Quaternion Rotation;
    Rotation.setValueAsQuat(q[1], q[2], q[3], q[0]);

    Transformation.setTransform(Translation,Rotation);

    if(isPlaceable())
    {

        t = dGeomGetPosition(_GeomID);
        Translation.setValues( t[0],t[1],t[2] );

        dGeomGetQuaternion(_GeomID, q);
        Rotation.setValueAsQuat(q[1], q[2], q[3], q[0]);

        Matrix NonBodyTransformation;
        NonBodyTransformation.setTransform(Translation,Rotation);
        Transformation.mult(NonBodyTransformation);
    }

    return Transformation;
}
コード例 #2
0
ファイル: pobject.cpp プロジェクト: jordanlewis/mobmentality
Vec3f PObject::getPos()
{
    if (isPlaceable())
    {
        const dReal *pos = dGeomGetPosition(geom);
        return Vec3f(pos[0], pos[1], pos[2]);
    }
    else
        return Vec3f(0,0,0);
}
コード例 #3
0
ファイル: Board.class.cpp プロジェクト: ccompera/ft_retro
bool	Board::place(Entity * entity, int x, int y) {

	if (!isPlaceable(entity, x, y)) {
		return (false);
	}
	if (entity->getType() == ENEMY)
	 	this->_onBoard->listAdd(entity);
	for (int i = 0; i < 9; i++) {
		for (int j = 0; j < entity->getWidth(); j++) {
			if (entity->getShape()[i][j] != ' ') {
				this->_board[x + i - 5][y + j - (entity->getWidth() / 2)].modify(entity, entity->getShape()[i][j], false);
			}
		}
	}
	return (true);
}
コード例 #4
0
ファイル: pobject.cpp プロジェクト: jordanlewis/mobmentality
void PObject::getQuat(Quatf_t quat)
{
    dReal dquat[4];
    if (isPlaceable())
    {
        dGeomGetQuaternion(geom, dquat);
        DQuatToQuatf(dquat, quat);
    }
    else
    {
        quat[0] = 0;
        quat[1] = 0;
        quat[2] = 0;
        quat[3] = 1;
    }

}