User Tools

Site Tools


scripting:baseworld

BaseWorld

Class: BaseWorld

Parent Class: (?pointer?)

Location: scripts/Core/generated/World/BaseWorld.c

Description: Base world class.

Common usage

The baseworld component is returned on the GetWorld() global command.

Typical usage : find an Entity.

GetWorld().FindEntityByName( string entity-name )

Functions

GetSurfaceY();

GetSurfaceY(float x, float z);

Return type: float

GetActiveEntities();

GetActiveEntities(notnull out array<IEntity> entities);

/*! Query for entities on the line. Entities are roughly sorted by distance from start to end of line \param from Start of line \param to End of line \param addEntity Callback method. called when another Entity is intersected during Query methods. \return Return true, when query should continue, False when you want to quit query call. \param filterEntity [optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior tointersection test \return True when entity has to be further tested, False otherwise \param queryFlags Various flags See EQueryEntitiesFlags \return False when query was canceled. */

Return type: void

QueryEntitiesByLine();

QueryEntitiesByLine(vector from, vector to, QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity = null, EQueryEntitiesFlags queryFlags = EQueryEntitiesFlags.ALL);

Return type: bool

QueryEntitiesByAABB();

QueryEntitiesByAABB(vector mins, vector maxs, QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity = null, EQueryEntitiesFlags queryFlags = EQueryEntitiesFlags.ALL);

/*! Query for entities touched by axis aligned box. \param mins Mins of axis aligned box \param maxs Maxs of axis aligned box \param addEntity Callback method. called when another Entity is intersected during Query methods. \return Return true, when query should continue, False when you want to quit query call. \param filterEntity [optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior tointersection test \return True when entity has to be further tested, False otherwise \param queryFlags Various flags See EQueryEntitiesFlags \return False when query was canceled. */

Return type: bool

QueryEntitiesBySphere();

QueryEntitiesBySphere(vector center, float radius, QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity = null, EQueryEntitiesFlags queryFlags = EQueryEntitiesFlags.ALL);

/*! Query for entities touched by sphere. \param center Center of sphere \param radius Radius of sphere \param addEntity Callback method. called when another Entity is intersected during Query methods. \return Return true, when query should continue, False when you want to quit query call. \param filterEntity [optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior tointersection test \return True when entity has to be further tested, False otherwise \param queryFlags Various flags See EQueryEntitiesFlags \return False when query was canceled. */

Return type: bool

QueryEntitiesByBeveledLine()

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 \param from Start of line \param to End of line \param bevelMins Mins of bevel axis aligned box \param bevelMaxs Maxs of bevel axis aligned box \param addEntity Callback method. called when another Entity is intersected during Query methods. \return Return true, when query should continue, False when you want to quit query call. \param filterEntity [optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior tointersection test \return True when entity has to be further tested, False otherwise \param queryFlags Various flags See EQueryEntitiesFlags \return False when query was canceled. */

Return type: bool

QueryEntitiesByOBB()

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

Query for entities touched by oriented box \param mins Mins of axis aligned box \param maxs Maxs of axis aligned box \param matrix Orientation of box \param addEntity Callback method. called when another Entity is intersected during Query methods. \return Return true, when query should continue, False when you want to quit query call. \param filterEntity [optional] Callback method. Called when another Entity is encountered during Query methods. Some light-weight filtering could be implemented here, prior tointersection test \return True when entity has to be further tested, False otherwise \param queryFlags Various flags See EQueryEntitiesFlags \return False when query was canceled.

Return type: bool

SchedulePreload()

SchedulePreload(vector pos, float radius);

Return type: void

GetBoundBox()

GetBoundBox(out vector mins, out vector maxs);

Return type: void

GetOceanHeight()

GetOceanHeight(float worldX, float worldZ);

Is ocean availabled

Return type: float

IsOcean()

IsOcean();

Get water ocean height at given point \param worldXworld x position \param worldZworld z position

Return type: float

GetOceanHeightAndDisplace()

GetOceanHeightAndDisplace(float worldX, float worldZ);

Get water ocean height and displacement at given point, returns vector(displaceX, height, displaceZ) \param worldXworld x position \param worldZworld z position

Return type: vector

GetOceanBaseHeight()

GetOceanBaseHeight();

return base ocean level

Return type: float

IsOceanEnabledInCamera()

IsOceanEnabledInCamera(int camera);

is in camera ocean enabled? \param cameracamera

Return type: bool

EnabledOceanInCamera()

EnabledOceanInCamera(int camera, bool enable);

enable ocean render in some camera \param cameracamera \param enableenabled = true

Return type: void

RegisterWaterBody()

RegisterWaterBody(notnull IEntity ent, ResourceName matName);

water body

Return type: float

RemoveWaterBody()

RemoveWaterBody(notnull IEntity ent);

remove water body

Return type: void

RemoveDecal()

RemoveDecal(Decal decal);

remove decal \param decal item to be removed

Return type: void

CreateTrackDecal()

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 \param entityentity where the Track should be created (only terrain is supported ATM) \param originfirst point of the decal, nothing is done now \param normalnormal of surface \param edgesizeEdge size of decal \param lifetimeLifetime in seconds \param materialName Material used for decal \param prevPrevious decal, we are connecting to \param alphatranslucency of point \return TrackDecal pointer or null

Return type: TrackDecal

GetCurrentCameraId()

GetCurrentCameraId(); 

Return type: int

SetCamera()

SetCamera(int cam, vector origin, vector angle);

Changes camera position \param cam Index of camera \param originposition \param angleorientation (angles <Yaw, Pitch, Roll> in degrees)

Return type: void

GetCamera()

GetCamera(int cam, out vector mat[4]);

Return type: void

GetCurrentCamera()

GetCurrentCamera(out vector mat[4]);

Return type: void

SetCameraEx();

SetCameraEx(int cam, const vector mat[4]);

Changes camera matrix

Return type: void

SetCameraVerticalFOV(int cam, float fovy);

SetCameraVerticalFOV(int cam, float fovy);

Default 5 units

Return type: void

SetCameraNearPlane()

SetCameraNearPlane(int cam, float nearplane);

Default 160000 units

Return type: void

SetCameraFarPlane()

SetCameraFarPlane(int cam, float farplane);

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

Return type: void

SetCameraHDRBrightness()

SetCameraHDRBrightness(int cam, float hdrBrightness);

Returns actual camera HDR exposure

Return type: void

GetCameraHDRBrightness();

GetCameraHDRBrightness(int cam);

Return type: float

SetCameraPostProcessEffect()

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 \param cam number of camera \param prioritypriority of effect, currently we support max 20 effects thus max priority is 19 (priority means also order of rendering, less = earlier) \param typetype of effect \param materialPath material

Return type: void

SetCameraType()

SetCameraType(int cam, CameraType type);

Set lens flare set for given camera. \param cam number of camera \param lensFlareSetTypetype of the lens flare set \param userLensFlareSetName name of the lens flare set (is used then type is set to User)

Return type: void

SetCameraLensFlareSet()

SetCameraLensFlareSet(int cam, CameraLensFlareSetType lensFlareSetType, string userLensFlareSetName);

Project a position from world to viewport of given resolution. \param pos Position in world space \param cam Camera index to use \param width Viewport width \param height Viewport height

Return type: void

ProjectWorldToViewport()

ProjectWorldToViewport(vector pos, int cam, int width, int height);

Project a position from viewport of given resolution to world. \param x Coord in viewport \param y Coord in viewport \param cam Camera index to use \param width Viewport width \param height Viewport height \param outDir Returned direction vector

Return type: vector

ProjectViewportToWorld()

ProjectViewportToWorld(float x, float y, int cam, int width, int height, out vector outDir);

Return type: vector

TraceLineToEntity()

TraceLineToEntity(notnull IEntity ent, vector start, vector end, out TraceContact contact);

Return type: bool

TracePosition()

TracePosition(inout TraceParam param, TraceEntitiesCallback filtercallback);

traces shape collision at start position, return <0 if we hit something

OUTPUT: returnsvalue 0 or negative number as penetration depth

Return type: float

TraceMove()

TraceMove(inout TraceParam param, TraceEntitiesCallback filtercallback);

traces shape movement along start→end, return 0..1 if trace was sucessfull.

OUTPUT: \returnsvalue 0…1, percentage of a path traveled

Return type: float

GetWorldTime()

GetWorldTime();

Returns current lifetime of the World in milliseconds

Return type: float

GetFrameNumber()

GetFrameNumber();

Returns current frame of the World

Return type: int

GetTimeScale()

GetTimeScale();

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

Return type: float

FindEntityByName()

FindEntityByName(string name);

Return type: IEntity

FindEntityByID()

FindEntityByID(EntityID ID); 

Return type: IEntity

IsEditMode()

IsEditMode();

Returns true during edit mode in Workbench and in Ingame editor

Return type: float

UpdateEntities()

UpdateEntities();

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

Return type: void

CreateWorld()

CreateWorld(string type, string name);

Create new empty BaseWorld

Return type: SharedItemRef

scripting/baseworld.txt · Last modified: 2022/08/09 22:53 by jerryhopper

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki