Enfusion Script API
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
BaseWorld Interface Reference
Inheritance diagram for BaseWorld:
[legend]

Public Member Functions

proto external float GetSurfaceY (float x, float z)
 
proto external void GetActiveEntities (notnull out array< IEntity > entities)
 
proto external bool QueryEntitiesByLine (vector from, vector to, QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity=null, EQueryEntitiesFlags queryFlags=EQueryEntitiesFlags.ALL)
 Query for entities on the line.
 
proto external bool QueryEntitiesByAABB (vector mins, vector maxs, QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity=null, EQueryEntitiesFlags queryFlags=EQueryEntitiesFlags.ALL)
 Query for entities touched by axis aligned box.
 
proto external bool QueryEntitiesBySphere (vector center, float radius, QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity=null, EQueryEntitiesFlags queryFlags=EQueryEntitiesFlags.ALL)
 Query for entities touched by sphere.
 
proto external bool QueryEntitiesByBeveledLine (vector from, vector to, vector bevelMins, vector bevelMaxs, QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity=null, EQueryEntitiesFlags queryFlags=EQueryEntitiesFlags.ALL)
 Query for entities on the beveled line (sweeping test by AABB) Entities are roughly sorted by distance from start to end of line.
 
proto external bool QueryEntitiesByOBB (vector mins, vector maxs, vector matrix[4], QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity=null, EQueryEntitiesFlags queryFlags=EQueryEntitiesFlags.ALL)
 Query for entities touched by oriented box.
 
proto external void SchedulePreload (vector pos, float radius)
 
proto external void GetBoundBox (out vector mins, out vector maxs)
 
proto external bool IsOcean ()
 Is ocean availabled.
 
proto external float GetOceanHeight (float worldX, float worldZ)
 Get water ocean height at given point.
 
proto external vector GetOceanHeightAndDisplace (float worldX, float worldZ)
 Get water ocean height and displacement at given point, returns vector(displaceX, height, displaceZ)
 
proto external float GetOceanBaseHeight ()
 return base ocean level
 
proto external bool IsOceanEnabledInCamera (int camera)
 is in camera ocean enabled?
 
proto external void EnabledOceanInCamera (int camera, bool enable)
 enable ocean render in some camera
 
proto external void RegisterWaterBody (notnull IEntity ent, ResourceName matName)
 
proto external void RemoveWaterBody (notnull IEntity ent)
 
proto external void RemoveDecal (Decal decal)
 remove decal
 
proto external TrackDecal CreateTrackDecal (IEntity entity, vector origin, vector normal, float edgeSize, float lifeTime, string materialName, Decal prevDecal, float alpha)
 Creates continous visual mark, e.g.
 
proto external int GetCurrentCameraId ()
 
proto external void SetCamera (int cam, vector origin, vector angle)
 Changes camera position.
 
proto external void GetCamera (int cam, out vector mat[4])
 
proto external void GetCurrentCamera (out vector mat[4])
 
proto external void SetCameraEx (int cam, const vector mat[4])
 Changes camera matrix.
 
proto external void SetCameraVerticalFOV (int cam, float fovy)
 
proto external void SetCameraNearPlane (int cam, float nearplane)
 Default 5 units.
 
proto external void SetCameraFarPlane (int cam, float farplane)
 Default 160000 units.
 
proto external void SetCameraHDRBrightness (int cam, float hdrBrightness)
 set HDR camera exposure (if hdrBrightness > 0, camera is set to manual mode with this exposure, set -1 to enable again auto mode)
 
proto external void AdjustCameraEV (int cam, float EV)
 adjust camera EV (light stops), 0 = no adjustment, both positive/negative values are allowed
 
proto external float GetCameraHDRBrightness (int cam)
 Returns actual camera HDR exposure.
 
proto external float GetCameraSceneMiddleBrightness (int cam)
 Returns actual camera normalized scene middle brightness.
 
proto external void SetCameraPostProcessEffect (int cam, int priority, PostProcessEffectType type, string materialPath)
 set postprocess effect to camera To disable effect in some prioroty ppEffect, just set effectName or name to NULL
 
proto external void SetCameraType (int cam, CameraType type)
 
proto external void SetCameraLensFlareSet (int cam, CameraLensFlareSetType lensFlareSetType, string userLensFlareSetName)
 Set lens flare set for given camera.
 
proto external vector ProjectWorldToViewport (vector pos, int cam, int width, int height)
 Project a position from world to viewport of given resolution.
 
proto external vector ProjectViewportToWorld (float x, float y, int cam, int width, int height, out vector outDir)
 Project a position from viewport of given resolution to world.
 
proto external bool TraceLineToEntity (notnull IEntity ent, vector start, vector end, Class placeHolder=null)
 
proto external float TracePosition (inout TraceParam param, TraceEntitiesCallback filtercallback)
 
proto external float TraceMove (inout TraceParam param, TraceEntitiesCallback filtercallback)
 
proto external float GetWorldTime ()
 Returns current lifetime of the World in milliseconds.
 
proto external WorldTimestamp GetTimestamp ()
 Returns current timestamp of the World.
 
proto external int GetFrameNumber ()
 Returns current frame of the World.
 
proto external float GetTimeScale ()
 Returns actual time scale of world, can be different from engine time scale.
 
proto external float GetTimeSlice ()
 Returns time slice of the world.
 
proto external float GetFixedTimeSlice ()
 Returns fixed time slice of the world.
 
proto external float GetPhysicsTimeSlice ()
 Returns physics time slice of the world.
 
proto external IEntity FindEntityByName (string name)
 
proto external IEntity FindEntityByID (EntityID ID)
 
proto external bool IsEditMode ()
 Returns true during edit mode in Workbench and in Ingame editor.
 
proto external void UpdateEntities ()
 Update active entities in the world, do not call from inside another world update (e.g. from IEntity::EOnXXX)
 
- Public Member Functions inherited from pointer
proto string ToString ()
 

Static Public Member Functions

static proto SharedItemRef CreateWorld (string type, string name)
 Create new empty BaseWorld.
 

Member Function Documentation

◆ AdjustCameraEV()

proto external void BaseWorld.AdjustCameraEV ( int  cam,
float  EV 
)

adjust camera EV (light stops), 0 = no adjustment, both positive/negative values are allowed

◆ CreateTrackDecal()

proto external TrackDecal BaseWorld.CreateTrackDecal ( IEntity  entity,
vector  origin,
vector  normal,
float  edgeSize,
float  lifeTime,
string  materialName,
Decal  prevDecal,
float  alpha 
)

Creates continous visual mark, e.g.

from wheel when a car is moving on the ground

Parameters
entityentity where the Track should be created (only terrain is supported ATM)
originfirst point of the decal, nothing is done now
normalnormal of surface
edgeSizeEdge size of decal
lifeTimeLifetime in seconds
materialNameMaterial used for decal
prevDecalPrevious decal, we are connecting to
alphatranslucency of point
Returns
TrackDecal pointer or null

◆ CreateWorld()

static proto SharedItemRef BaseWorld.CreateWorld ( string  type,
string  name 
)
static

Create new empty BaseWorld.

◆ EnabledOceanInCamera()

proto external void BaseWorld.EnabledOceanInCamera ( int  camera,
bool  enable 
)

enable ocean render in some camera

Parameters
cameracamera
enableenabled = true

◆ FindEntityByID()

proto external IEntity BaseWorld.FindEntityByID ( EntityID  ID)

◆ FindEntityByName()

proto external IEntity BaseWorld.FindEntityByName ( string  name)

◆ GetActiveEntities()

proto external void BaseWorld.GetActiveEntities ( notnull out array< IEntity entities)

◆ GetBoundBox()

proto external void BaseWorld.GetBoundBox ( out vector  mins,
out vector  maxs 
)

◆ GetCamera()

proto external void BaseWorld.GetCamera ( int  cam,
out vector  mat[4] 
)

◆ GetCameraHDRBrightness()

proto external float BaseWorld.GetCameraHDRBrightness ( int  cam)

Returns actual camera HDR exposure.

◆ GetCameraSceneMiddleBrightness()

proto external float BaseWorld.GetCameraSceneMiddleBrightness ( int  cam)

Returns actual camera normalized scene middle brightness.

◆ GetCurrentCamera()

proto external void BaseWorld.GetCurrentCamera ( out vector  mat[4])

◆ GetCurrentCameraId()

proto external int BaseWorld.GetCurrentCameraId ( )

◆ GetFixedTimeSlice()

proto external float BaseWorld.GetFixedTimeSlice ( )

Returns fixed time slice of the world.

◆ GetFrameNumber()

proto external int BaseWorld.GetFrameNumber ( )

Returns current frame of the World.

◆ GetOceanBaseHeight()

proto external float BaseWorld.GetOceanBaseHeight ( )

return base ocean level

◆ GetOceanHeight()

proto external float BaseWorld.GetOceanHeight ( float  worldX,
float  worldZ 
)

Get water ocean height at given point.

Parameters
worldXworld x position
worldZworld z position

◆ GetOceanHeightAndDisplace()

proto external vector BaseWorld.GetOceanHeightAndDisplace ( float  worldX,
float  worldZ 
)

Get water ocean height and displacement at given point, returns vector(displaceX, height, displaceZ)

Parameters
worldXworld x position
worldZworld z position

◆ GetPhysicsTimeSlice()

proto external float BaseWorld.GetPhysicsTimeSlice ( )

Returns physics time slice of the world.

◆ GetSurfaceY()

proto external float BaseWorld.GetSurfaceY ( float  x,
float  z 
)

◆ GetTimeScale()

proto external float BaseWorld.GetTimeScale ( )

Returns actual time scale of world, can be different from engine time scale.

◆ GetTimeSlice()

proto external float BaseWorld.GetTimeSlice ( )

Returns time slice of the world.

◆ GetTimestamp()

proto external WorldTimestamp BaseWorld.GetTimestamp ( )

Returns current timestamp of the World.

◆ GetWorldTime()

proto external float BaseWorld.GetWorldTime ( )

Returns current lifetime of the World in milliseconds.

◆ IsEditMode()

proto external bool BaseWorld.IsEditMode ( )

Returns true during edit mode in Workbench and in Ingame editor.

◆ IsOcean()

proto external bool BaseWorld.IsOcean ( )

Is ocean availabled.

◆ IsOceanEnabledInCamera()

proto external bool BaseWorld.IsOceanEnabledInCamera ( int  camera)

is in camera ocean enabled?

Parameters
cameracamera

◆ ProjectViewportToWorld()

proto external vector BaseWorld.ProjectViewportToWorld ( float  x,
float  y,
int  cam,
int  width,
int  height,
out vector  outDir 
)

Project a position from viewport of given resolution to world.

Parameters
xCoord in viewport
yCoord in viewport
camCamera index to use
widthViewport width
heightViewport height
outDirReturned direction vector

◆ ProjectWorldToViewport()

proto external vector BaseWorld.ProjectWorldToViewport ( vector  pos,
int  cam,
int  width,
int  height 
)

Project a position from world to viewport of given resolution.

Parameters
posPosition in world space
camCamera index to use
widthViewport width
heightViewport height

◆ QueryEntitiesByAABB()

proto external bool BaseWorld.QueryEntitiesByAABB ( vector  mins,
vector  maxs,
QueryEntitiesCallback  addEntity,
QueryEntitiesCallback  filterEntity = null,
EQueryEntitiesFlags  queryFlags = EQueryEntitiesFlags.ALL 
)

Query for entities touched by axis aligned box.

Parameters
minsMins of axis aligned box
maxsMaxs of axis aligned box
addEntityCallback method. called when another Entity is intersected during Query methods.
Returns
Return true, when query should continue, False when you want to quit query call.
Parameters
filterEntity[optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior to intersection test
Returns
True when entity has to be further tested, False otherwise
Parameters
queryFlagsVarious flags See EQueryEntitiesFlags
Returns
False when query was canceled.

◆ QueryEntitiesByBeveledLine()

proto external bool BaseWorld.QueryEntitiesByBeveledLine ( vector  from,
vector  to,
vector  bevelMins,
vector  bevelMaxs,
QueryEntitiesCallback  addEntity,
QueryEntitiesCallback  filterEntity = null,
EQueryEntitiesFlags  queryFlags = EQueryEntitiesFlags.ALL 
)

Query for entities on the beveled line (sweeping test by AABB) Entities are roughly sorted by distance from start to end of line.

Parameters
fromStart of line
toEnd of line
bevelMinsMins of bevel axis aligned box
bevelMaxsMaxs of bevel axis aligned box
addEntityCallback method. called when another Entity is intersected during Query methods.
Returns
Return true, when query should continue, False when you want to quit query call.
Parameters
filterEntity[optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior to intersection test
Returns
True when entity has to be further tested, False otherwise
Parameters
queryFlagsVarious flags See EQueryEntitiesFlags
Returns
False when query was canceled.

◆ QueryEntitiesByLine()

proto external bool BaseWorld.QueryEntitiesByLine ( vector  from,
vector  to,
QueryEntitiesCallback  addEntity,
QueryEntitiesCallback  filterEntity = null,
EQueryEntitiesFlags  queryFlags = EQueryEntitiesFlags.ALL 
)

Query for entities on the line.

Entities are roughly sorted by distance from start to end of line

Parameters
fromStart of line
toEnd of line
addEntityCallback method. called when another Entity is intersected during Query methods.
Returns
Return true, when query should continue, False when you want to quit query call.
Parameters
filterEntity[optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior to intersection test
Returns
True when entity has to be further tested, False otherwise
Parameters
queryFlagsVarious flags See EQueryEntitiesFlags
Returns
False when query was canceled.

◆ QueryEntitiesByOBB()

proto external bool BaseWorld.QueryEntitiesByOBB ( vector  mins,
vector  maxs,
vector  matrix[4],
QueryEntitiesCallback  addEntity,
QueryEntitiesCallback  filterEntity = null,
EQueryEntitiesFlags  queryFlags = EQueryEntitiesFlags.ALL 
)

Query for entities touched by oriented box.

Parameters
minsMins of axis aligned box
maxsMaxs of axis aligned box
matrixOrientation of box
addEntityCallback method. called when another Entity is intersected during Query methods.
Returns
Return true, when query should continue, False when you want to quit query call.
Parameters
filterEntity[optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior to intersection test
Returns
True when entity has to be further tested, False otherwise
Parameters
queryFlagsVarious flags See EQueryEntitiesFlags
Returns
False when query was canceled.

◆ QueryEntitiesBySphere()

proto external bool BaseWorld.QueryEntitiesBySphere ( vector  center,
float  radius,
QueryEntitiesCallback  addEntity,
QueryEntitiesCallback  filterEntity = null,
EQueryEntitiesFlags  queryFlags = EQueryEntitiesFlags.ALL 
)

Query for entities touched by sphere.

Parameters
centerCenter of sphere
radiusRadius of sphere
addEntityCallback method. called when another Entity is intersected during Query methods.
Returns
Return true, when query should continue, False when you want to quit query call.
Parameters
filterEntity[optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior to intersection test
Returns
True when entity has to be further tested, False otherwise
Parameters
queryFlagsVarious flags See EQueryEntitiesFlags
Returns
False when query was canceled.

◆ RegisterWaterBody()

proto external void BaseWorld.RegisterWaterBody ( notnull IEntity  ent,
ResourceName  matName 
)

◆ RemoveDecal()

proto external void BaseWorld.RemoveDecal ( Decal  decal)

remove decal

Parameters
decalitem to be removed

◆ RemoveWaterBody()

proto external void BaseWorld.RemoveWaterBody ( notnull IEntity  ent)

◆ SchedulePreload()

proto external void BaseWorld.SchedulePreload ( vector  pos,
float  radius 
)

◆ SetCamera()

proto external void BaseWorld.SetCamera ( int  cam,
vector  origin,
vector  angle 
)

Changes camera position.

Parameters
camIndex of camera
originposition
angleorientation (angles <Yaw, Pitch, Roll> in degrees)

◆ SetCameraEx()

proto external void BaseWorld.SetCameraEx ( int  cam,
const vector  mat[4] 
)

Changes camera matrix.

◆ SetCameraFarPlane()

proto external void BaseWorld.SetCameraFarPlane ( int  cam,
float  farplane 
)

Default 160000 units.

◆ SetCameraHDRBrightness()

proto external void BaseWorld.SetCameraHDRBrightness ( int  cam,
float  hdrBrightness 
)

set HDR camera exposure (if hdrBrightness > 0, camera is set to manual mode with this exposure, set -1 to enable again auto mode)

◆ SetCameraLensFlareSet()

proto external void BaseWorld.SetCameraLensFlareSet ( int  cam,
CameraLensFlareSetType  lensFlareSetType,
string  userLensFlareSetName 
)

Set lens flare set for given camera.

Parameters
camnumber of camera
lensFlareSetTypetype of the lens flare set
userLensFlareSetNamename of the lens flare set (is used then type is set to User)

◆ SetCameraNearPlane()

proto external void BaseWorld.SetCameraNearPlane ( int  cam,
float  nearplane 
)

Default 5 units.

◆ SetCameraPostProcessEffect()

proto external void BaseWorld.SetCameraPostProcessEffect ( int  cam,
int  priority,
PostProcessEffectType  type,
string  materialPath 
)

set postprocess effect to camera To disable effect in some prioroty ppEffect, just set effectName or name to NULL

Parameters
camnumber of camera
prioritypriority of effect, currently we support max 20 effects thus max priority is 19 (priority means also order of rendering, less = earlier)
typetype of effect
materialPathmaterial

◆ SetCameraType()

proto external void BaseWorld.SetCameraType ( int  cam,
CameraType  type 
)

◆ SetCameraVerticalFOV()

proto external void BaseWorld.SetCameraVerticalFOV ( int  cam,
float  fovy 
)

◆ TraceLineToEntity()

proto external bool BaseWorld.TraceLineToEntity ( notnull IEntity  ent,
vector  start,
vector  end,
Class  placeHolder = null 
)

◆ TraceMove()

proto external float BaseWorld.TraceMove ( inout TraceParam  param,
TraceEntitiesCallback  filtercallback 
)
traces shape movement along start->end, return 0..1 if trace was sucessfull.

OUTPUT:

Returns
value 0...1, percentage of a path traveled

◆ TracePosition()

proto external float BaseWorld.TracePosition ( inout TraceParam  param,
TraceEntitiesCallback  filtercallback 
)
traces shape collision at start position, return <0 if we hit something

OUTPUT:

Returns
value 0 or negative number as penetration depth

◆ UpdateEntities()

proto external void BaseWorld.UpdateEntities ( )

Update active entities in the world, do not call from inside another world update (e.g. from IEntity::EOnXXX)


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