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

Difference between revisions of "setorigin"

From Quake Wiki

m (Example)
 
Line 11: Line 11:
  
 
== Example ==
 
== Example ==
  vector angs = e.angles;
+
  makevectors([-e.angles.x, e.angles.y, e.angles.z]);
angs_x = -angs_x;
 
makevectors(angs);
 
 
   
 
   
 
  // Move the entity 32 units forward in the direction it's facing
 
  // Move the entity 32 units forward in the direction it's facing

Latest revision as of 02:00, 31 July 2023

void setorigin(entity e, vector newPos)

Usage[edit]

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[edit]

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

Example[edit]

makevectors([-e.angles.x, e.angles.y, e.angles.z]);

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