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

Difference between revisions of "setorigin"

From Quake Wiki

Line 1: Line 1:
====Syntax:====
+
''void'' '''setorigin'''(''entity'' e, ''vector'' newPos)
<code>void setorigin(entity e, vector vec)</code>
 
  
Sets the entity <code>e</code> to the position specified with <code>vec</code>. This is the correct way of setting an entity's position in the game.  Setting the <code>.origin</code> variable manually will cause problems with rendering.
+
== Usage ==
====Parameters:====
+
Sets the entity's position. This should be used over setting '''origin''' manually since it will properly relink the entity into the world. This can also be used as an easy way to relink an entity after changing their solid type by passing their current position.
:<code>e</code> - The entity who's origin to set
+
 
:<code>vec</code> - The new vector coordinates of the entity
+
=== Parameters ===
====Returns:====
+
*''e''
:void
+
:The entity to set the origin of.
 +
*''newPos''
 +
:The new location to place the entity.
 +
 
 +
== Example ==
 +
vector angs = e.angles;
 +
angs_x = -angs_x;
 +
makevectors(angs);
 +
 +
// Move the entity 32 units forward in the direction it's facing
 +
setorigin(e, e.origin + v_forward*32);
  
 
[[Category:QuakeC Function]]
 
[[Category:QuakeC Function]]

Revision as of 01:48, 31 July 2023

void setorigin(entity e, vector newPos)

Usage

Sets the entity's position. This should be used over setting origin manually since it will properly relink the entity into the world. This can also be used as an easy way to relink an entity after changing their solid type by passing their current position.

Parameters

  • e
The entity to set the origin of.
  • newPos
The new location to place the entity.

Example

vector angs = e.angles;
angs_x = -angs_x;
makevectors(angs);

// Move the entity 32 units forward in the direction it's facing
setorigin(e, e.origin + v_forward*32);