Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "setsize"

From Quake Wiki

 
Line 1: Line 1:
====Syntax:====
+
''void'' '''setsize'''(''entity'' e, ''vector'' minSize, ''vector'' maxSize)
<code>void setsize(entity e, vector mins, vector maxs)</code>
 
  
Sets the size of the entity's bounding box, relative to the entity origin. The size box is rotated by the current angle of the entity.
+
== Usage ==
====Parameters:====
+
Sets the extents of the entity's bounding box relative to its origin. This is axis aligned meaning it does not rotate with the entity. Sets the '''mins''', '''maxs''', and '''size''' fields. These should not be modified manually since the entity needs to be properly relinked to the world after changing size.
:<code>e</code> - The entity who's model is being set
+
 
:<code>mins</code> - The coordinates of the minimum corner of the bounding box (ex: [[VEC_HULL2_MIN]])
+
For BSP entities, do not use this function. <code>setmodel()</code> will automatically set their size information.
:<code>maxs</code> - The coordinates of the maximum corner of the bounding box (must be larger than mins) (ex: [[VEC_HULL2_MIN]])
+
 
====Returns:====
+
'''Warning:''' For collisions with BSPs, the Minkowski sum is pre-calculated, but only for the <code>VEC_HULL_MIN/MAX</code> and <code>VEC_HULL2_MIN/MAX</code> sizes. Collisions with other entities will work fine if you deviate from these, but collisions with BSP models specifically will become imprecise. Use caution when going outside these.
:void
+
 
 +
=== Parameters ===
 +
*''e''
 +
:The entity whose size is being set.
 +
*''minSize''
 +
:The size of the box from the origin pointing down towards the left. These should use negative values or they will not be offset from the origin correctly.
 +
*''maxSize''
 +
:The size of the box from the origin pointing up towards the right. These should use positive values or they will not be offset from the origin correctly.
 +
 
 +
== Example ==
 +
// Sets the non-BSP entity to the standard collision size
 +
setsize(e, VEC_HULL_MIN, VEC_HULL_MAX);
  
 
[[Category:QuakeC Function]]
 
[[Category:QuakeC Function]]

Latest revision as of 10:47, 31 July 2023

void setsize(entity e, vector minSize, vector maxSize)

Usage[edit]

Sets the extents of the entity's bounding box relative to its origin. This is axis aligned meaning it does not rotate with the entity. Sets the mins, maxs, and size fields. These should not be modified manually since the entity needs to be properly relinked to the world after changing size.

For BSP entities, do not use this function. setmodel() will automatically set their size information.

Warning: For collisions with BSPs, the Minkowski sum is pre-calculated, but only for the VEC_HULL_MIN/MAX and VEC_HULL2_MIN/MAX sizes. Collisions with other entities will work fine if you deviate from these, but collisions with BSP models specifically will become imprecise. Use caution when going outside these.

Parameters[edit]

  • e
The entity whose size is being set.
  • minSize
The size of the box from the origin pointing down towards the left. These should use negative values or they will not be offset from the origin correctly.
  • maxSize
The size of the box from the origin pointing up towards the right. These should use positive values or they will not be offset from the origin correctly.

Example[edit]

// Sets the non-BSP entity to the standard collision size
setsize(e, VEC_HULL_MIN, VEC_HULL_MAX);