====== 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 : [[scripting:baseworld#findentitybyname|find an Entity]]. GetWorld().FindEntityByName( string entity-name ) --- ===== Functions ===== ==== GetSurfaceY(); ==== GetSurfaceY(float x, float z); Return type: [[scripting:datatypes#float]] ==== GetActiveEntities(); ==== GetActiveEntities(notnull out array 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: [[scripting:datatypes#void]] ==== QueryEntitiesByLine(); ==== QueryEntitiesByLine(vector from, vector to, QueryEntitiesCallback addEntity, QueryEntitiesCallback filterEntity = null, EQueryEntitiesFlags queryFlags = EQueryEntitiesFlags.ALL); Return type: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#bool]] ==== SchedulePreload() ==== SchedulePreload(vector pos, float radius); Return type: [[scripting:datatypes#void]] ==== GetBoundBox() ==== GetBoundBox(out vector mins, out vector maxs); Return type: [[scripting:datatypes#void]] ==== GetOceanHeight() ==== GetOceanHeight(float worldX, float worldZ); Is ocean availabled Return type: [[scripting:datatypes#float]] ==== IsOcean() ==== IsOcean(); Get water ocean height at given point \param worldXworld x position \param worldZworld z position Return type: [[scripting:datatypes#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: [[scripting:datatypes#vector]] ==== GetOceanBaseHeight() ==== GetOceanBaseHeight(); return base ocean level Return type: [[scripting:datatypes#float]] ==== IsOceanEnabledInCamera() ==== IsOceanEnabledInCamera(int camera); is in camera ocean enabled? \param cameracamera Return type: [[scripting:datatypes#bool]] ==== EnabledOceanInCamera() ==== EnabledOceanInCamera(int camera, bool enable); enable ocean render in some camera \param cameracamera \param enableenabled = true Return type: [[scripting:datatypes#void]] ==== RegisterWaterBody() ==== RegisterWaterBody(notnull IEntity ent, ResourceName matName); water body Return type: [[scripting:datatypes#float]] ==== RemoveWaterBody() ==== RemoveWaterBody(notnull IEntity ent); remove water body Return type: [[scripting:datatypes#void]] ==== RemoveDecal() ==== RemoveDecal(Decal decal); remove decal \param decal item to be removed Return type: [[scripting:datatypes#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: [[scripting:datatypes#TrackDecal]] ==== GetCurrentCameraId() ==== GetCurrentCameraId(); Return type: [[scripting:datatypes#int]] ==== SetCamera() ==== SetCamera(int cam, vector origin, vector angle); Changes camera position \param cam Index of camera \param originposition \param angleorientation (angles in degrees) Return type: [[scripting:datatypes#void]] ==== GetCamera() ==== GetCamera(int cam, out vector mat[4]); Return type: [[scripting:datatypes#void]] ==== GetCurrentCamera() ==== GetCurrentCamera(out vector mat[4]); Return type: [[scripting:datatypes#void]] ==== SetCameraEx(); ==== SetCameraEx(int cam, const vector mat[4]); Changes camera matrix Return type: [[scripting:datatypes#void]] ==== SetCameraVerticalFOV(int cam, float fovy); ==== SetCameraVerticalFOV(int cam, float fovy); Default 5 units Return type: [[scripting:datatypes#void]] ==== SetCameraNearPlane() ==== SetCameraNearPlane(int cam, float nearplane); Default 160000 units Return type: [[scripting:datatypes#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: [[scripting:datatypes#void]] ==== SetCameraHDRBrightness() ==== SetCameraHDRBrightness(int cam, float hdrBrightness); Returns actual camera HDR exposure Return type: [[scripting:datatypes#void]] ==== GetCameraHDRBrightness(); ==== GetCameraHDRBrightness(int cam); Return type: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#vector]] ==== ProjectViewportToWorld() ==== ProjectViewportToWorld(float x, float y, int cam, int width, int height, out vector outDir); Return type: [[scripting:datatypes#vector]] ==== TraceLineToEntity() ==== TraceLineToEntity(notnull IEntity ent, vector start, vector end, out TraceContact contact); Return type: [[scripting:datatypes#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: [[scripting:datatypes#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: [[scripting:datatypes#float]] ==== GetWorldTime() ==== GetWorldTime(); Returns current lifetime of the World in milliseconds Return type: [[scripting:datatypes#float]] ==== GetFrameNumber() ==== GetFrameNumber(); Returns current frame of the World Return type: [[scripting:datatypes#int]] ==== GetTimeScale() ==== GetTimeScale(); Returns actual time scale of world, can be different from engine time scale Return type: [[scripting:datatypes#float]] ==== FindEntityByName() ==== FindEntityByName(string name); Return type: [[scripting:datatypes#IEntity]] ==== FindEntityByID() ==== FindEntityByID(EntityID ID); Return type: [[scripting:datatypes#IEntity]] ==== IsEditMode() ==== IsEditMode(); Returns true during edit mode in Workbench and in Ingame editor Return type: [[scripting:datatypes#float]] ==== UpdateEntities() ==== UpdateEntities(); Update active entities in the world, do not call from inside another world update (e.g. from IEntity::EOnXXX) Return type: [[scripting:datatypes#void]] ==== CreateWorld() ==== CreateWorld(string type, string name); Create new empty BaseWorld Return type: [[scripting:datatypes#SharedItemRef ]]