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

This function adds a new shape to an actor, using the size of the entity2. It can be used to put a complex physics shape together from basic shapes. If you want to create even more complex actors, use pXent_settype with PH_CONVEX.

Parameters:

entity1 Registered entity pointer (Actor)
entity2 Entity (added shape size) or NULL for using entity1's size.
hull PH_BOX, PH_SPHERE or PH_CAPSULE

Returns:

Nonzero if successful, 0 otherwise.

Remarks:

entity2 is only used as a template for the shape size and position. It is otherwise not affected by the function.

Speed:

Fast

Examples:

...
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);
}

See also:

pXent_settype, pXent_removeshape