示例#1
0
	//constraint between two different rigidbodies
	btVehicleJacobianEntry(
			const Basis &world2A,
			const Basis &world2B,
			const Vector3 &rel_pos1,
			const Vector3 &rel_pos2,
			const Vector3 &jointAxis,
			const Vector3 &inertiaInvA,
			const real_t massInvA,
			const Vector3 &inertiaInvB,
			const real_t massInvB) :
			m_linearJointAxis(jointAxis) {
		m_aJ = world2A.xform(rel_pos1.cross(m_linearJointAxis));
		m_bJ = world2B.xform(rel_pos2.cross(-m_linearJointAxis));
		m_0MinvJt = inertiaInvA * m_aJ;
		m_1MinvJt = inertiaInvB * m_bJ;
		m_Adiag = massInvA + m_0MinvJt.dot(m_aJ) + massInvB + m_1MinvJt.dot(m_bJ);

		//btAssert(m_Adiag > real_t(0.0));
	}
示例#2
0
void GridMapEditor::_duplicate_paste() {

	if (!selection.active)
		return;

	int idx = options->get_popup()->get_item_index(MENU_OPTION_DUPLICATE_SELECTS);
	bool reselect = options->get_popup()->is_item_checked( idx );



	List< __Item > items;

	Basis rot;
	rot.set_orthogonal_index(selection.duplicate_rot);

	for(int i=selection.begin.x;i<=selection.end.x;i++) {

		for(int j=selection.begin.y;j<=selection.end.y;j++) {

			for(int k=selection.begin.z;k<=selection.end.z;k++) {

				int itm = node->get_cell_item(i,j,k);
				if (itm==GridMap::INVALID_CELL_ITEM)
					continue;
				int orientation = node->get_cell_item_orientation(i,j,k);
				__Item item;
				Vector3 rel=Vector3(i,j,k)-selection.begin;
				rel = rot.xform(rel);

				Basis orm;
				orm.set_orthogonal_index(orientation);
				orm = rot * orm;

				item.pos=selection.begin+rel;
				item.item=itm;
				item.rot=orm.get_orthogonal_index();
				items.push_back(item);
			}

		}
	}

	Vector3 ofs=selection.current-selection.click;
	if (items.size()) {
		undo_redo->create_action("GridMap Duplicate Selection");
		for(List< __Item >::Element *E=items.front();E;E=E->next()) {
			__Item &it=E->get();
			Vector3 pos = it.pos+ofs;

			undo_redo->add_do_method(node,"set_cell_item",pos.x,pos.y,pos.z,it.item,it.rot);
			undo_redo->add_undo_method(node,"set_cell_item",pos.x,pos.y,pos.z,node->get_cell_item(pos.x,pos.y,pos.z),node->get_cell_item_orientation(pos.x,pos.y,pos.z));

		}
		undo_redo->commit_action();
	}


	if (reselect) {

		selection.begin+=ofs;
		selection.end+=ofs;
		selection.click=selection.begin;
		selection.current=selection.end;
		_validate_selection();
	}

}