|
Enfusion Script API
|
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. | |
adjust camera EV (light stops), 0 = no adjustment, both positive/negative values are allowed
| 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
| entity | entity where the Track should be created (only terrain is supported ATM) |
| origin | first point of the decal, nothing is done now |
| normal | normal of surface |
| edgeSize | Edge size of decal |
| lifeTime | Lifetime in seconds |
| materialName | Material used for decal |
| prevDecal | Previous decal, we are connecting to |
| alpha | translucency of point |
|
static |
Create new empty BaseWorld.
enable ocean render in some camera
| camera | camera |
| enable | enabled = true |
Returns actual camera HDR exposure.
Returns actual camera normalized scene middle brightness.
| proto external void BaseWorld.GetCurrentCamera | ( | out vector | mat[4] | ) |
| proto external int BaseWorld.GetCurrentCameraId | ( | ) |
| proto external float BaseWorld.GetFixedTimeSlice | ( | ) |
Returns fixed time slice of the world.
| proto external float BaseWorld.GetOceanBaseHeight | ( | ) |
return base ocean level
Get water ocean height at given point.
| worldX | world x position |
| worldZ | world z position |
Get water ocean height and displacement at given point, returns vector(displaceX, height, displaceZ)
| worldX | world x position |
| worldZ | world z position |
| proto external float BaseWorld.GetPhysicsTimeSlice | ( | ) |
Returns physics time slice of the world.
| proto external float BaseWorld.GetTimeScale | ( | ) |
Returns actual time scale of world, can be different from engine time scale.
| proto external float BaseWorld.GetTimeSlice | ( | ) |
Returns time slice of the world.
| proto external WorldTimestamp BaseWorld.GetTimestamp | ( | ) |
Returns current timestamp of the World.
| proto external float BaseWorld.GetWorldTime | ( | ) |
Returns current lifetime of the World in milliseconds.
| proto external bool BaseWorld.IsEditMode | ( | ) |
Returns true during edit mode in Workbench and in Ingame editor.
| proto external bool BaseWorld.IsOcean | ( | ) |
Is ocean availabled.
is in camera ocean enabled?
| camera | camera |
| 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.
| x | Coord in viewport |
| y | Coord in viewport |
| cam | Camera index to use |
| width | Viewport width |
| height | Viewport height |
| outDir | Returned direction vector |
| proto external vector BaseWorld.ProjectWorldToViewport | ( | vector | pos, |
| int | cam, | ||
| int | width, | ||
| int | height ) |
Project a position from world to viewport of given resolution.
| pos | Position in world space |
| cam | Camera index to use |
| width | Viewport width |
| height | Viewport height |
| 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.
| mins | Mins of axis aligned box |
| maxs | Maxs of axis aligned box |
| addEntity | Callback method. called when another Entity is intersected during Query methods. |
| 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 |
| queryFlags | Various flags See EQueryEntitiesFlags |
| 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.
| from | Start of line |
| to | End of line |
| bevelMins | Mins of bevel axis aligned box |
| bevelMaxs | Maxs of bevel axis aligned box |
| addEntity | Callback method. called when another Entity is intersected during Query methods. |
| 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 |
| queryFlags | Various flags See EQueryEntitiesFlags |
| 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
| from | Start of line |
| to | End of line |
| addEntity | Callback method. called when another Entity is intersected during Query methods. |
| 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 |
| queryFlags | Various flags See EQueryEntitiesFlags |
| 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.
| mins | Mins of axis aligned box |
| maxs | Maxs of axis aligned box |
| matrix | Orientation of box |
| addEntity | Callback method. called when another Entity is intersected during Query methods. |
| 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 |
| queryFlags | Various flags See EQueryEntitiesFlags |
| proto external bool BaseWorld.QueryEntitiesBySphere | ( | vector | center, |
| float | radius, | ||
| QueryEntitiesCallback | addEntity, | ||
| QueryEntitiesCallback | filterEntity = null, | ||
| EQueryEntitiesFlags | queryFlags = EQueryEntitiesFlags.ALL ) |
Query for entities touched by sphere.
| center | Center of sphere |
| radius | Radius of sphere |
| addEntity | Callback method. called when another Entity is intersected during Query methods. |
| 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 |
| queryFlags | Various flags See EQueryEntitiesFlags |
| proto external void BaseWorld.RegisterWaterBody | ( | notnull IEntity | ent, |
| ResourceName | matName ) |
| proto external void BaseWorld.RemoveDecal | ( | Decal | decal | ) |
remove decal
| decal | item to be removed |
| proto external void BaseWorld.RemoveWaterBody | ( | notnull IEntity | ent | ) |
Changes camera position.
| cam | Index of camera |
| origin | position |
| angle | orientation (angles <Yaw, Pitch, Roll> in degrees) |
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 BaseWorld.SetCameraLensFlareSet | ( | int | cam, |
| CameraLensFlareSetType | lensFlareSetType, | ||
| string | userLensFlareSetName ) |
Set lens flare set for given camera.
| cam | number of camera |
| lensFlareSetType | type of the lens flare set |
| userLensFlareSetName | name of the lens flare set (is used then type is set to User) |
| 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
| cam | number of camera |
| priority | priority of effect, currently we support max 20 effects thus max priority is 19 (priority means also order of rendering, less = earlier) |
| type | type of effect |
| materialPath | material |
| proto external void BaseWorld.SetCameraType | ( | int | cam, |
| CameraType | type ) |
| proto external bool BaseWorld.TraceLineToEntity | ( | notnull IEntity | ent, |
| vector | start, | ||
| vector | end, | ||
| Class | placeHolder = null ) |
| proto external float BaseWorld.TraceMove | ( | inout TraceParam | param, |
| TraceEntitiesCallback | filtercallback ) |
traces shape movement along start->end, return 0..1 if trace was sucessfull.
OUTPUT:
| proto external float BaseWorld.TracePosition | ( | inout TraceParam | param, |
| TraceEntitiesCallback | filtercallback ) |
traces shape collision at start position, return <0 if we hit something
OUTPUT:
| proto external void BaseWorld.UpdateEntities | ( | ) |
Update active entities in the world, do not call from inside another world update (e.g. from IEntity.EOnXXX)