Collision cache : stores a set of triangles, each with an ID, for use with the other collision classes.
- Note
- Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
The following function fills a GeColliderCache from a BaseObject:
{
ModelingCommandData md1; md1.op = &
obj; md1.doc =
obj.GetDocument();
return false;
ModelingCommandData md2; md2.op = static_cast<BaseObject*>(md1.result->GetIndex(0));
return false;
AutoAlloc<PolygonObject> poly(static_cast<PolygonObject*>(md2.op));
if (!poly)
return false;
CPolygon* tris = poly->GetPolygon();
Vector* points = poly->GetPoint();
if (
c.BeginInput(poly->GetPolygonCount()) !=
COL_OK)
return false;
for (
int i = 0;
i < poly->GetPolygonCount(); ++
i)
{
if (
c.AddTriangle(points[tris[
i].a], points[tris[
i].b], points[tris[
i].c],
i) !=
COL_OK)
return false;
}
return false;
return true;
}
Py_ssize_t i
Definition: abstract.h:645
PyObject * obj
Definition: complexobject.h:60
Py_UNICODE c
Definition: unicodeobject.h:1200
#define COL_OK
OK.
Definition: lib_collider.h:24
#define MCOMMAND_CURRENTSTATETOOBJECT
Current state to object (returns object): MDATA_CURRENTSTATETOOBJECT.
Definition: ge_prepass.h:1652
#define MCOMMAND_TRIANGULATE
Triangulate.
Definition: ge_prepass.h:1641
maxon::Bool Bool
Definition: ge_sys_math.h:46
Bool SendModelingCommand(Int32 command, ModelingCommandData &data)
Executes a builtin modelling operation as for example extruding a polygon selection or selecting all ...
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:140