Arma Reforger Script API
Loading...
Searching...
No Matches
SCR_Global Interface Reference

SCR_Global Class. More...

Static Public Member Functions

static bool IsScope2DEnabled ()
 
static string GetPlatformName (PlatformKind kind)
 
static string GetProfileName ()
 
static vector FixVector180 (vector vec)
 Fixes the angles in the input vector to be be between -180 and 180.
 
static vector GetVectorClampedToWorldBounds (vector pos)
 Clamps input vector to within world bounds.
 
static bool GetIntersectPointPlane (vector start, vector end, out vector result, float height)
 Returns the intersect point between 2 points and a height.
 
static void GetDistForHUD (float dist, bool imperial, out string tgtDist, out string distFormat)
 Fills the 2 out strings with distance in the appropriate unit and unit of measurement.
 
static bool FilterCallback_IgnoreNotInList (notnull IEntity target)
 Trace filter callback function - ignores all but for the objects in the g_TraceFilterList list.
 
static bool FilterCallback_IgnoreCharactersWithChildren (notnull IEntity target)
 Trace filter callback function - ignores characters and their children.
 
static bool FilterCallback_IgnoreCharacters (notnull IEntity target)
 Trace filter callback function - ignores characters.
 
static bool FilterCallback_IgnoreEntityWithChildren (notnull IEntity target, vector rayorigin, vector raydirection)
 Trace filter callback function - ignores g_TraceFilterEnt and its children.
 
static bool FilterCallback_IgnoreAllButEntityWithChildren (notnull IEntity target, vector rayorigin, vector raydirection)
 Trace filter callback function - ignores all BUT g_TraceFilterEnt and its children.
 
static bool FilterCallback_IgnoreAllButEntity (notnull IEntity target, vector rayorigin, vector raydirection)
 Trace filter callback function - ignores all BUT g_TraceFilterEnt.
 
static bool FilterCallback_IgnoreAllButMeleeAttackable (notnull IEntity target, vector rayorigin, vector raydirection)
 Trace filter callback function - ignores all BUT Characters/Trees TODO:
 
static bool FilterCallback_IgnoreAllButBuildingRegions (notnull IEntity target, vector rayorigin, vector raydirection)
 Trace filter callback function - ignores all but building regions type.
 
static float GetScaledStructuralDamage (float damage, EDamageType type)
 Scales damage to structural components by damage type and returns final value.
 
static int GetChildIndex (IEntity ent)
 Returns child index for the input child entity, returns -1 if not found.
 
static array< ref ParamEnum > GetBonesAsParamEnums (IEntity entity)
 Creates array of ParamEnums filled with pairs of bones names and their indexes in the EntityTagsComponent.
 
static void SetEntityAsChildToParent (IEntity parent, IEntity child)
 Sets the input child entity as a child of the input parent entity, handling adjustments of transformations.
 
static vector ScaleVectorByVector (vector inputVec, vector scaleVec)
 Returns a scaled vector by scaling each axis separately.
 
static float GetGlobalYawForMat (vector mat[4])
 Returns global yaw orientation for input matrix.
 
static void LerpMatrix (vector mat1[4], vector mat2[4], out vector matOut[4], float pct)
 
static void GetLocalMatrix (vector parentMat[4], vector childMat[4])
 Returns local matrix of input matrices.
 
static void GetWorldBoundsForEntity (vector mat[4], out vector mins, out vector maxs)
 Returns world bounds from input matrix and bounds.
 
static void GetWorldBoundsWithChildren (IEntity entity, out vector min, out vector max, bool isChild=false)
 Get world bounds of whole entity hierarchy, i.e., of itself and all its children.
 
static bool GetObjectAtOffsetFromObject (IEntity parent, IEntity child, vector localPos, vector localAng, float tolerancePos, float toleranceAng)
 Returns whether object 1 is at the desired position in object 2.
 
static bool IntersectBoxPoint (vector pos, vector mins, vector maxs)
 Returns whether input point is within bounds.
 
static bool IntersectBoxSphere (vector center, float radius, vector mins, vector maxs, out float intersectDist=0)
 Returns whether input sphere intersects with bounds with optional intersection distance output (negative values are within the box)
 
static float FractionOf (float input, float fracOf)
 Limit float between -1 and 1.
 
static float ClampToGrid (float input, float grid)
 Clamp value to a grid size.
 
static vector GetDirectionAngles (vector viewMat[4], vector posTo)
 Returns relative yaw/pitch/roll to position from input view matrix.
 
static float fmod (float dividend, float divisor)
 Takes two floats and returns the remainder after division.
 
static void WorldClampMatrixWithinBounds (vector mat[4], vector mins, vector maxs)
 Takes input matrix and keeps it within the input bounds.
 
static int VectorToRGBA255 (vector colorVec, float alpha)
 Return full color using input vector for color and input alpha (0 - 255)
 
static void WorldClampObjectAndMatrixWithinBounds (GenericEntity ent, vector mat[4], vector mins, vector maxs, vector gridSize)
 Takes input object and matrix and keeps it within the input bounds and optional gridsnap.
 
static void LocalClampObjectAndMatrixWithinBounds (vector localMat[4], GenericEntity ent, vector origMat[4], vector localMins, vector localMaxs, vector gridSize)
 Takes input object and matrix and keeps it within the input bounds and optional gridsnap.
 
static void WorldSnapMatrix (vector mat[4], vector gridSize)
 Take the input matrix and snaps the rotation to 90 degree, world-oriented angles. Also snaps the position to the input grid size.
 
static void LocalSnapMatrix (vector localMat[4], vector origMat[4], vector gridSize)
 Take the input matrix and snaps the rotation to 90 degree, local-oriented angles. Also snaps the position to the input grid size.
 
static float GetMatAndBoundsSurfaceAreaInDir (IEntity ent, vector dir, vector mat[4], vector mins, vector maxs)
 Returns 2D surface area (in m^2) for the input bound box and matrix.
 
static float GetSurfaceAreaInDir (IEntity ent, vector dir)
 Returns 2D surface area (in m^2) of the object's bounding box exposed in the input direction.
 
static vector GetEntityCenterLocal (IEntity ent)
 Returns the center of the entity from its bounding box in local coordinates.
 
static bool GetStringContainsInvalidCharacters (string s)
 Returns whether the input string contains invalid characters (for file names)
 
static void DisplayEntityNameText (IEntity ent, int color, int camIndex)
 Show the name of the entity above it using the input camera index for direction etc.
 
static void SetHierarchyVelocity (notnull IEntity ent, vector newVelocity)
 Set linear velocity for whole hierarchy.
 
static void SetHierarchyAngularVelocity (notnull IEntity ent, vector newAngularVelocity)
 Set angular velocity for whole hierarchy.
 
static void SetHierarchyBodyActive (notnull IEntity ent, ActiveState activeState, bool resetVelocity=false)
 Sets physics active state for whole hierarchy.
 
static bool IsAnyInherited (notnull IEntity entity, array< TypeName > typenames)
 Returns true if the given entity is inherited from list of typesnames given as argument.
 
static bool ApplyDamage (IEntity entity, IEntity weapon, float dmg, EDamageType dmgType, string hitZone, SurfaceProperties surface, int nodeIdx)
 
static ActionsManagerComponent FindActionsManagerComponent (IEntity entity, bool activeOnly=true)
 Check whether entity has actions manager and return it if it exists.
 
static SCR_EditorActionsManagerComponent FindEditorActionsManagerComponent (IEntity entity)
 Check whether entity has editor actions manager and return it if it exists.
 
static bool GetModelAndRemapFromResource (ResourceName resourcePath, out ResourceName modelPath, out string remap)
 Read the input resource and returns whether a model was successfully found, filling the output model and remap paths.
 
static bool GetResourceContainsComponent (ResourceName resourcePath, string componentClassName, out bool isPrefab)
 Read the input resource and returns whether it contains a component on input name, filling whether the resource is a prefab.
 
static bool IsEditMode ()
 Check if the game is running in edit mode.
 
static bool IsEditMode (notnull IEntity entity)
 Check if the entity is running in edit mode.
 
static vector ProjWorldEditorMouseScreenToWorld (GenericEntity referenceEntity)
 Calculates the world direction of the mouse cursor projected into world space in the World Editor.
 
static bool TeleportLocalPlayer (vector worldPosition, SCR_EPlayerTeleportedReason teleportReason=SCR_EPlayerTeleportedReason.DEFAULT)
 Teleport local player to given position.
 
static bool TeleportPlayer (int playerId, vector worldPosition, SCR_EPlayerTeleportedReason teleportReason=SCR_EPlayerTeleportedReason.DEFAULT)
 Teleport player to given position.
 
static void DrawMatrix (vector matrix[4], float scale=1, ShapeFlags flags=ShapeFlags.ONCE|ShapeFlags.NOZBUFFER, int colorX=Color.RED, int colorY=Color.GREEN, int colorZ=Color.BLUE)
 Draw lines representing transformation matrix.
 
static void DrawTrace (TraceParam trace, float traceCoef=-1, ShapeFlags flags=ShapeFlags.ONCE|ShapeFlags.NOZBUFFER|ShapeFlags.NOOUTLINE, int colorEnd=Color.BLACK, int colorIntersect=Color.PINK)
 Draw lines representing trace param.
 
static void SetMaterial (IEntity entity, ResourceName material, bool recursively=true)
 Set material to an entity.
 
static bool IsChangedMouseAndKeyboard (EInputDeviceType oldDevice, EInputDeviceType newDevice)
 Check if the change triggered by GetGame().OnInputDeviceUserChangedInvoker() is only between mouse and keyboard.
 
static ResourceName GetRootWorld (ResourceName worldPath=ResourceName.Empty)
 Get path to the root world.
 
static ResourceName GetResourceName (string path)
 Get resource name of a file on given path.
 
static int GetFrequencies (SCR_GadgetManagerComponent gadgetManager, out notnull set< int > outFrequencies)
 Get all frequencies entity with given gadget manager listens to.
 
static bool IsAdminRole (EPlayerRole role)
 Check if given player role has admin rights.
 
static bool IsAdmin (int playerID)
 Check if given player is an admin.
 
static bool IsAdmin ()
 Check if local player is an admin.
 
static ResourceName GetPrefabAttributeResource (notnull IEntity entity, string containerType, string attributeName)
 Get attribute resourceName from a specified component of the entity's prefab.
 

Static Public Attributes

static Widget m_DebugLayoutCanvas
 For debug canvas drawing funcitons.
 
static IEntity g_TraceFilterEnt = null
 Pointer to entity that should be used for various trace filters (below)
 
static ref set< IEntity > g_TraceFilterList = new set<IEntity>()
 List of entities for use in trace filters (below)
 
static float g_fPhysicsHz = 60
 Physics update in Hz (TODO: Get via PhysicsWorld instead once implemented)
 

Static Protected Member Functions

static void SetHierarchyChildVelocity (notnull IEntity ent, vector newVelocity, bool recursive=true)
 Called from SetHierarchyVelocity.
 
static void SetHierarchyChildAngularVelocity (notnull IEntity ent, vector newAngularVelocity, IEntity entFrom, bool recursive=true)
 Called from SetHierarchyAngularVelocity.
 
static void SetHierarchyChildBodyActive (notnull IEntity ent, ActiveState activeState, bool recursive=true, bool resetVelocity=false)
 Called from SetHierarchyBodyActive.
 

Detailed Description

SCR_Global Class.

Contains various useful global script functions

Member Function Documentation

◆ ApplyDamage()

static bool SCR_Global.ApplyDamage ( IEntity entity,
IEntity weapon,
float dmg,
EDamageType dmgType,
string hitZone,
SurfaceProperties surface,
int nodeIdx )
static

Keep that as the last check

check if the entity has the damage manager component

no hitzone given, use the default one if exist

◆ ClampToGrid()

static float SCR_Global.ClampToGrid ( float input,
float grid )
static

Clamp value to a grid size.

◆ DisplayEntityNameText()

static void SCR_Global.DisplayEntityNameText ( IEntity ent,
int color,
int camIndex )
static

Show the name of the entity above it using the input camera index for direction etc.

◆ DrawMatrix()

static void SCR_Global.DrawMatrix ( vector matrix[4],
float scale = 1,
ShapeFlags flags = ShapeFlags::ONCE | ShapeFlags::NOZBUFFER,
int colorX = Color::RED,
int colorY = Color::GREEN,
int colorZ = Color::BLUE )
static

Draw lines representing transformation matrix.

Parameters
matrixTransformation matrix in world space
scaleLength of lines in meters
flagsShape flags
colorXColor of longitudinal line
colorYColor of vertical line
colorZColor of lateral line

◆ DrawTrace()

static void SCR_Global.DrawTrace ( TraceParam trace,
float traceCoef = -1,
ShapeFlags flags = ShapeFlags::ONCE | ShapeFlags::NOZBUFFER | ShapeFlags::NOOUTLINE,
int colorEnd = Color::BLACK,
int colorIntersect = Color::PINK )
static

Draw lines representing trace param.

Parameters
traceTrace param
traceCoefTrace coef calculated e.g., by BaseWorld.TraceMove
flagsShape flags
colorEndColor of the line going from intersection point to TraceParam.End
colorIntersectColor of the line going from TraceParam.Start to intersection point

◆ FilterCallback_IgnoreAllButBuildingRegions()

static bool SCR_Global.FilterCallback_IgnoreAllButBuildingRegions ( notnull IEntity target,
vector rayorigin,
vector raydirection )
static

Trace filter callback function - ignores all but building regions type.

◆ FilterCallback_IgnoreAllButEntity()

static bool SCR_Global.FilterCallback_IgnoreAllButEntity ( notnull IEntity target,
vector rayorigin,
vector raydirection )
static

Trace filter callback function - ignores all BUT g_TraceFilterEnt.

◆ FilterCallback_IgnoreAllButEntityWithChildren()

static bool SCR_Global.FilterCallback_IgnoreAllButEntityWithChildren ( notnull IEntity target,
vector rayorigin,
vector raydirection )
static

Trace filter callback function - ignores all BUT g_TraceFilterEnt and its children.

◆ FilterCallback_IgnoreAllButMeleeAttackable()

static bool SCR_Global.FilterCallback_IgnoreAllButMeleeAttackable ( notnull IEntity target,
vector rayorigin,
vector raydirection )
static

Trace filter callback function - ignores all BUT Characters/Trees TODO:

  • add small object destruction

◆ FilterCallback_IgnoreCharacters()

static bool SCR_Global.FilterCallback_IgnoreCharacters ( notnull IEntity target)
static

Trace filter callback function - ignores characters.

◆ FilterCallback_IgnoreCharactersWithChildren()

static bool SCR_Global.FilterCallback_IgnoreCharactersWithChildren ( notnull IEntity target)
static

Trace filter callback function - ignores characters and their children.

◆ FilterCallback_IgnoreEntityWithChildren()

static bool SCR_Global.FilterCallback_IgnoreEntityWithChildren ( notnull IEntity target,
vector rayorigin,
vector raydirection )
static

Trace filter callback function - ignores g_TraceFilterEnt and its children.

◆ FilterCallback_IgnoreNotInList()

static bool SCR_Global.FilterCallback_IgnoreNotInList ( notnull IEntity target)
static

Trace filter callback function - ignores all but for the objects in the g_TraceFilterList list.

◆ FindActionsManagerComponent()

static ActionsManagerComponent SCR_Global.FindActionsManagerComponent ( IEntity entity,
bool activeOnly = true )
static

Check whether entity has actions manager and return it if it exists.

Parameters
entityThe entity to find the actions manager component on.
Returns
True when actions manager is present, false otherwise.

◆ FindEditorActionsManagerComponent()

static SCR_EditorActionsManagerComponent SCR_Global.FindEditorActionsManagerComponent ( IEntity entity)
static

Check whether entity has editor actions manager and return it if it exists.

Parameters
entityThe entity to find the actions manager component on.
Returns
True when actions manager is present, false otherwise.

◆ FixVector180()

static vector SCR_Global.FixVector180 ( vector vec)
static

Fixes the angles in the input vector to be be between -180 and 180.

◆ fmod()

static float SCR_Global.fmod ( float dividend,
float divisor )
static

Takes two floats and returns the remainder after division.

◆ FractionOf()

static float SCR_Global.FractionOf ( float input,
float fracOf )
static

Limit float between -1 and 1.

◆ GetBonesAsParamEnums()

static array< ref ParamEnum > SCR_Global.GetBonesAsParamEnums ( IEntity entity)
static

Creates array of ParamEnums filled with pairs of bones names and their indexes in the EntityTagsComponent.

◆ GetChildIndex()

static int SCR_Global.GetChildIndex ( IEntity ent)
static

Returns child index for the input child entity, returns -1 if not found.

◆ GetDirectionAngles()

static vector SCR_Global.GetDirectionAngles ( vector viewMat[4],
vector posTo )
static

Returns relative yaw/pitch/roll to position from input view matrix.

◆ GetDistForHUD()

static void SCR_Global.GetDistForHUD ( float dist,
bool imperial,
out string tgtDist,
out string distFormat )
static

Fills the 2 out strings with distance in the appropriate unit and unit of measurement.

Parameters
distInput distance
imperialWhether to use imperial system of units (else uses metric system)
tgtDistOutput string for distance
distFormatOutput string for distance units (m, km, etc)

◆ GetEntityCenterLocal()

static vector SCR_Global.GetEntityCenterLocal ( IEntity ent)
static

Returns the center of the entity from its bounding box in local coordinates.

◆ GetFrequencies()

static int SCR_Global.GetFrequencies ( SCR_GadgetManagerComponent gadgetManager,
out notnull set< int > outFrequencies )
static

Get all frequencies entity with given gadget manager listens to.

Parameters
gadgetManagerGadget manager
[out]outFrequenciesList to be filled with unique frequencies
Returns
Number of frequencies

◆ GetGlobalYawForMat()

static float SCR_Global.GetGlobalYawForMat ( vector mat[4])
static

Returns global yaw orientation for input matrix.

◆ GetIntersectPointPlane()

static bool SCR_Global.GetIntersectPointPlane ( vector start,
vector end,
out vector result,
float height )
static

Returns the intersect point between 2 points and a height.

Parameters
startStart position to check intersect from
endEnd position to check intersect to
resultReturned intersect position
heightWorld height to do intersect plane at

◆ GetLocalMatrix()

static void SCR_Global.GetLocalMatrix ( vector parentMat[4],
vector childMat[4] )
static

Returns local matrix of input matrices.

◆ GetMatAndBoundsSurfaceAreaInDir()

static float SCR_Global.GetMatAndBoundsSurfaceAreaInDir ( IEntity ent,
vector dir,
vector mat[4],
vector mins,
vector maxs )
static

Returns 2D surface area (in m^2) for the input bound box and matrix.

◆ GetModelAndRemapFromResource()

static bool SCR_Global.GetModelAndRemapFromResource ( ResourceName resourcePath,
out ResourceName modelPath,
out string remap )
static

Read the input resource and returns whether a model was successfully found, filling the output model and remap paths.

◆ GetObjectAtOffsetFromObject()

static bool SCR_Global.GetObjectAtOffsetFromObject ( IEntity parent,
IEntity child,
vector localPos,
vector localAng,
float tolerancePos,
float toleranceAng )
static

Returns whether object 1 is at the desired position in object 2.

◆ GetPlatformName()

static string SCR_Global.GetPlatformName ( PlatformKind kind)
static

◆ GetPrefabAttributeResource()

static ResourceName SCR_Global.GetPrefabAttributeResource ( notnull IEntity entity,
string containerType,
string attributeName )
static

Get attribute resourceName from a specified component of the entity's prefab.

Parameters
entityEntity to get resourceName for
containerTypeName of the container, for example "MeshObject"
attributeNameName of the attribute, for example "Object"
Returns
resourceName Path to resource

◆ GetProfileName()

static string SCR_Global.GetProfileName ( )
static

◆ GetResourceContainsComponent()

static bool SCR_Global.GetResourceContainsComponent ( ResourceName resourcePath,
string componentClassName,
out bool isPrefab )
static

Read the input resource and returns whether it contains a component on input name, filling whether the resource is a prefab.

◆ GetResourceName()

static ResourceName SCR_Global.GetResourceName ( string path)
static

Get resource name of a file on given path.

The file must exist and have meta file, otherwise empty string is returned!

Parameters
pathFile path
Returns
Resource name with GUID

◆ GetRootWorld()

static ResourceName SCR_Global.GetRootWorld ( ResourceName worldPath = ResourceName::Empty)
static

Get path to the root world.

If the world is a sub-scene, it will go through all its ancestors to find the root.

Parameters
worldPathChecked world. When empty, current world will be used.
Returns
Resource name with GUID

◆ GetScaledStructuralDamage()

static float SCR_Global.GetScaledStructuralDamage ( float damage,
EDamageType type )
static

Scales damage to structural components by damage type and returns final value.

◆ GetStringContainsInvalidCharacters()

static bool SCR_Global.GetStringContainsInvalidCharacters ( string s)
static

Returns whether the input string contains invalid characters (for file names)

◆ GetSurfaceAreaInDir()

static float SCR_Global.GetSurfaceAreaInDir ( IEntity ent,
vector dir )
static

Returns 2D surface area (in m^2) of the object's bounding box exposed in the input direction.

◆ GetVectorClampedToWorldBounds()

static vector SCR_Global.GetVectorClampedToWorldBounds ( vector pos)
static

Clamps input vector to within world bounds.

Parameters
posPosition to clamp to world bounds

◆ GetWorldBoundsForEntity()

static void SCR_Global.GetWorldBoundsForEntity ( vector mat[4],
out vector mins,
out vector maxs )
static

Returns world bounds from input matrix and bounds.

◆ GetWorldBoundsWithChildren()

static void SCR_Global.GetWorldBoundsWithChildren ( IEntity entity,
out vector min,
out vector max,
bool isChild = false )
static

Get world bounds of whole entity hierarchy, i.e., of itself and all its children.

Parameters
entityEvaluated entity
[out]minBounding box minimum
[out]maxBounding box maximum

◆ IntersectBoxPoint()

static bool SCR_Global.IntersectBoxPoint ( vector pos,
vector mins,
vector maxs )
static

Returns whether input point is within bounds.

◆ IntersectBoxSphere()

static bool SCR_Global.IntersectBoxSphere ( vector center,
float radius,
vector mins,
vector maxs,
out float intersectDist = 0 )
static

Returns whether input sphere intersects with bounds with optional intersection distance output (negative values are within the box)

◆ IsAdmin() [1/2]

static bool SCR_Global.IsAdmin ( )
static

Check if local player is an admin.

Returns
True when player with given ID is an admin.

◆ IsAdmin() [2/2]

static bool SCR_Global.IsAdmin ( int playerID)
static

Check if given player is an admin.

Parameters
playerIDID of queried player
Returns
True when player with given ID is an admin.

◆ IsAdminRole()

static bool SCR_Global.IsAdminRole ( EPlayerRole role)
static

Check if given player role has admin rights.

Parameters
rolePlayer role
Returns
True when the role has admin rights

◆ IsAnyInherited()

static bool SCR_Global.IsAnyInherited ( notnull IEntity entity,
array< TypeName > typenames )
static

Returns true if the given entity is inherited from list of typesnames given as argument.

◆ IsChangedMouseAndKeyboard()

static bool SCR_Global.IsChangedMouseAndKeyboard ( EInputDeviceType oldDevice,
EInputDeviceType newDevice )
static

Check if the change triggered by GetGame().OnInputDeviceUserChangedInvoker() is only between mouse and keyboard.

Used in scripts which need to reset some variables when switching from mouse+keyboard and gamepad, but not when switching just between mouse and keyboard.

Parameters
oldDevicePreviously active device
newDeviceCurrently active device
Returns
True when the change is from mouse to keyboard or vice versa

◆ IsEditMode() [1/2]

static bool SCR_Global.IsEditMode ( )
static

Check if the game is running in edit mode.

Returns
true during edit mode in Workbench or if GetGame() is null

◆ IsEditMode() [2/2]

static bool SCR_Global.IsEditMode ( notnull IEntity entity)
static

Check if the entity is running in edit mode.

Parameters
entityEntity whose world will be checked
Returns
True during edit mode in Workbench

◆ IsScope2DEnabled()

static bool SCR_Global.IsScope2DEnabled ( )
static

◆ LerpMatrix()

static void SCR_Global.LerpMatrix ( vector mat1[4],
vector mat2[4],
out vector matOut[4],
float pct )
static

◆ LocalClampObjectAndMatrixWithinBounds()

static void SCR_Global.LocalClampObjectAndMatrixWithinBounds ( vector localMat[4],
GenericEntity ent,
vector origMat[4],
vector localMins,
vector localMaxs,
vector gridSize )
static

Takes input object and matrix and keeps it within the input bounds and optional gridsnap.

◆ LocalSnapMatrix()

static void SCR_Global.LocalSnapMatrix ( vector localMat[4],
vector origMat[4],
vector gridSize )
static

Take the input matrix and snaps the rotation to 90 degree, local-oriented angles. Also snaps the position to the input grid size.

◆ ProjWorldEditorMouseScreenToWorld()

static vector SCR_Global.ProjWorldEditorMouseScreenToWorld ( GenericEntity referenceEntity)
static

Calculates the world direction of the mouse cursor projected into world space in the World Editor.

Parameters
referenceEntityEntity to get the world, camera, and editor API from
Returns
Direction in world space

◆ ScaleVectorByVector()

static vector SCR_Global.ScaleVectorByVector ( vector inputVec,
vector scaleVec )
static

Returns a scaled vector by scaling each axis separately.

◆ SetEntityAsChildToParent()

static void SCR_Global.SetEntityAsChildToParent ( IEntity parent,
IEntity child )
static

Sets the input child entity as a child of the input parent entity, handling adjustments of transformations.

◆ SetHierarchyAngularVelocity()

static void SCR_Global.SetHierarchyAngularVelocity ( notnull IEntity ent,
vector newAngularVelocity )
static

Set angular velocity for whole hierarchy.

◆ SetHierarchyBodyActive()

static void SCR_Global.SetHierarchyBodyActive ( notnull IEntity ent,
ActiveState activeState,
bool resetVelocity = false )
static

Sets physics active state for whole hierarchy.

◆ SetHierarchyChildAngularVelocity()

static void SCR_Global.SetHierarchyChildAngularVelocity ( notnull IEntity ent,
vector newAngularVelocity,
IEntity entFrom,
bool recursive = true )
staticprotected

Called from SetHierarchyAngularVelocity.

◆ SetHierarchyChildBodyActive()

static void SCR_Global.SetHierarchyChildBodyActive ( notnull IEntity ent,
ActiveState activeState,
bool recursive = true,
bool resetVelocity = false )
staticprotected

Called from SetHierarchyBodyActive.

◆ SetHierarchyChildVelocity()

static void SCR_Global.SetHierarchyChildVelocity ( notnull IEntity ent,
vector newVelocity,
bool recursive = true )
staticprotected

Called from SetHierarchyVelocity.

◆ SetHierarchyVelocity()

static void SCR_Global.SetHierarchyVelocity ( notnull IEntity ent,
vector newVelocity )
static

Set linear velocity for whole hierarchy.

◆ SetMaterial()

static void SCR_Global.SetMaterial ( IEntity entity,
ResourceName material,
bool recursively = true )
static

Set material to an entity.

Parameters
entityAffected entity
materialMaterial to be applied
recursivelyTrue to apply the material also to children

◆ TeleportLocalPlayer()

static bool SCR_Global.TeleportLocalPlayer ( vector worldPosition,
SCR_EPlayerTeleportedReason teleportReason = SCR_EPlayerTeleportedReason::DEFAULT )
static

Teleport local player to given position.

Parameters
worldPositionWorld position
teleportReasonDictates the notifcation the player gets when teleported. DEFAULT reason has no notification associated with it
Returns
True if the operation was performed successfully

◆ TeleportPlayer()

static bool SCR_Global.TeleportPlayer ( int playerId,
vector worldPosition,
SCR_EPlayerTeleportedReason teleportReason = SCR_EPlayerTeleportedReason::DEFAULT )
static

Teleport player to given position.

Parameters
playerIdID of teleported player
worldPositionWorld position
teleportReasonDictates the notifcation the player gets when teleported. DEFAULT reason has no notification associated with it
Returns
True if the operation was performed successfully

◆ VectorToRGBA255()

static int SCR_Global.VectorToRGBA255 ( vector colorVec,
float alpha )
static

Return full color using input vector for color and input alpha (0 - 255)

◆ WorldClampMatrixWithinBounds()

static void SCR_Global.WorldClampMatrixWithinBounds ( vector mat[4],
vector mins,
vector maxs )
static

Takes input matrix and keeps it within the input bounds.

◆ WorldClampObjectAndMatrixWithinBounds()

static void SCR_Global.WorldClampObjectAndMatrixWithinBounds ( GenericEntity ent,
vector mat[4],
vector mins,
vector maxs,
vector gridSize )
static

Takes input object and matrix and keeps it within the input bounds and optional gridsnap.

◆ WorldSnapMatrix()

static void SCR_Global.WorldSnapMatrix ( vector mat[4],
vector gridSize )
static

Take the input matrix and snaps the rotation to 90 degree, world-oriented angles. Also snaps the position to the input grid size.

Member Data Documentation

◆ g_fPhysicsHz

float SCR_Global.g_fPhysicsHz = 60
static

Physics update in Hz (TODO: Get via PhysicsWorld instead once implemented)

◆ g_TraceFilterEnt

IEntity SCR_Global.g_TraceFilterEnt = null
static

Pointer to entity that should be used for various trace filters (below)

◆ g_TraceFilterList

ref set<IEntity> SCR_Global.g_TraceFilterList = new set<IEntity>()
static

List of entities for use in trace filters (below)

◆ m_DebugLayoutCanvas

Widget SCR_Global.m_DebugLayoutCanvas
static

For debug canvas drawing funcitons.


The documentation for this interface was generated from the following file: