pXent_addshape (ENTITY* entity1, ENTITY* entity2, var hull );

Diese Funktion fügt einem Actor eine neue Kollisionsform hinzu und verwendet dazu die Größe von entity2. Mithilfe dieser Funktion lässt sich eine komplexe Physik-Kollisionsform aus Grundformen zusammenstellen. Eine andere Art, kompliziert geformte Actors zu erstellen, ist pXent_settype mit PH_CONVEX.

Parameter:

entity1 Registrierter Entity-Pointer (Actor)
entity2 Entity (Formgröße) oder NULL für die Verwendung der Größe von entity1
hull PH_BOX, PH_SPHERE oder PH_CAPSULE

Rückgabewerte:

Ungleich Null, wenn erfolgreich, ansonsten 0.

Geschwindigkeit:

Schnell

Bemerkung:

entity2 wird nur für die Abmessungen und Position der Form benutzt und sonst von der Funktion nicht beeinflusst.

Beispiele:

...
pXent_addshape(my, you, PH_BOX); // adds a box-Actor with the size of the you entity to the my-entity-Actor. pXent_removeshape(my, 1); //removes the added box
function compound_test()
{
	ENTITY* ceiling = ent_create("tor.mdl",vector(-40,100,40),NULL);
	ceiling.pan=90;
	
	ENTITY* shell_top = ent_create("shell2.mdl",vector(-40,100,80),NULL);
	shell_top.roll = 90;
	shell_top.scale_x = shell_top.scale_y = 0.4;
	shell_top.scale_z = 3;
	ENTITY* shell_left = ent_create("shell2.mdl",vector(-40,147,40),NULL);
	shell_left.scale_x = shell_left.scale_y = 0.4;
	shell_left.scale_z = 6;
	ENTITY* shell_right = ent_create("shell2.mdl",vector(-40,53,40),NULL);
	shell_right.scale_x = shell_right.scale_y = 0.4;
	shell_right.scale_z = 6;
	ENTITY* sphere_left = ent_create("earth.mdl",vector(-40,147,80),NULL);
	ENTITY* sphere_right = ent_create("earth.mdl",vector(-40,53,80),NULL);
	
	pXent_settype(ceiling,3,PH_BOX);
	pXent_addshape(ceiling, shell_top, PH_BOX);
	pXent_addshape(ceiling, shell_left, PH_CAPSULE);
	pXent_addshape(ceiling, shell_right, PH_CAPSULE);
	pXent_addshape(ceiling, sphere_left, PH_SPHERE);
	pXent_addshape(ceiling, sphere_right, PH_SPHERE);
	
	ent_remove(shell_top);
	ent_remove(shell_left);
	ent_remove(shell_right);
	ent_remove(sphere_left);
	ent_remove(sphere_right);
}

Siehe auch:

pXent_settype, pXent_removeshape