Interface IMyEntity
Inherited Members
Namespace: VRage.ModAPI
Assembly: VRage.Game.dll
Syntax
public interface IMyEntity : IMyEntity
Properties
CastShadows
Gets or sets flag Cast
Declaration
bool CastShadows { get; set; }
Property Value
Type | Description |
---|---|
System. |
DebugAsyncLoading
Used for internal usage. Modders should not use it. Will be eventually removed
Declaration
bool DebugAsyncLoading { get; }
Property Value
Type | Description |
---|---|
System. |
DisplayName
Gets or sets user friendly name of entity
Declaration
string DisplayName { get; set; }
Property Value
Type | Description |
---|---|
System. |
EntityId
Uniq id of entity.
Declaration
long EntityId { get; set; }
Property Value
Type | Description |
---|---|
System. |
See Also
FastCastShadowResolve
Gets or sets flag Cast
Declaration
bool FastCastShadowResolve { get; set; }
Property Value
Type | Description |
---|---|
System. |
Flags
Gets or set some behavior of entity. Entity
Declaration
EntityFlags Flags { get; set; }
Property Value
Type | Description |
---|---|
Entity |
GameLogic
Gets or sets game logic for object. If there is more than 1 game logic attached it should be wrapped into MyCompositeGameLogicComponent.
Declaration
MyEntityComponentBase GameLogic { get; set; }
Property Value
Type | Description |
---|---|
My |
See Also
Hierarchy
Gets or sets Hierarchy component
Declaration
MyHierarchyComponentBase Hierarchy { get; set; }
Property Value
Type | Description |
---|---|
My |
InScene
Gets or set if grid is InScene. Objects that are not in scene are not updated and drawn.
Declaration
bool InScene { get; set; }
Property Value
Type | Description |
---|---|
System. |
InvalidateOnMove
Gets if entity is invalidated on move When visual look of entity depends on position - then InvalidateOnMove should be true
Declaration
bool InvalidateOnMove { get; }
Property Value
Type | Description |
---|---|
System. |
IsCCDForProjectiles
Declaration
bool IsCCDForProjectiles { get; }
Property Value
Type | Description |
---|---|
System. |
IsVolumetric
Always returns false
Declaration
bool IsVolumetric { get; }
Property Value
Type | Description |
---|---|
System. |
LocalAABB
Gets or sets local axis aligned bounding box. Same as Local
Declaration
BoundingBox LocalAABB { get; set; }
Property Value
Type | Description |
---|---|
Bounding |
LocalAABBHr
Declaration
BoundingBox LocalAABBHr { get; }
Property Value
Type | Description |
---|---|
Bounding |
LocalMatrix
Gets or sets local matrix. When entity, has parent, it's world coordinates are calculated from localMatrix and parent world matrix
Declaration
Matrix LocalMatrix { get; set; }
Property Value
Type | Description |
---|---|
Matrix |
LocalVolume
Gets or sets local volume. Same as Local
Declaration
BoundingSphere LocalVolume { get; set; }
Property Value
Type | Description |
---|---|
Bounding |
LocalVolumeOffset
Gets or sets local volume offset. Same as Local
Declaration
Vector3 LocalVolumeOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
LocationForHudMarker
Declaration
Vector3D LocationForHudMarker { get; }
Property Value
Type | Description |
---|---|
Vector3D |
MarkedForClose
Checked if Close() was called
Declaration
bool MarkedForClose { get; }
Property Value
Type | Description |
---|---|
System. |
MaxGlassDistSq
Not used in game anymore
Declaration
float MaxGlassDistSq { get; }
Property Value
Type | Description |
---|---|
System. |
Model
Gets model of block
Declaration
IMyModel Model { get; }
Property Value
Type | Description |
---|---|
IMy |
ModelCollision
Gets collision model of block
Declaration
IMyModel ModelCollision { get; }
Property Value
Type | Description |
---|---|
IMy |
Name
Uniq name of entity. Can be used to find entity by name
Declaration
string Name { get; set; }
Property Value
Type | Description |
---|---|
System. |
NearFlag
Gets or sets flag Near
Declaration
bool NearFlag { get; set; }
Property Value
Type | Description |
---|---|
System. |
NeedsDraw
Gets or sets flag Needs
Declaration
bool NeedsDraw { get; set; }
Property Value
Type | Description |
---|---|
System. |
NeedsDrawFromParent
Gets or sets flag Needs
Declaration
bool NeedsDrawFromParent { get; set; }
Property Value
Type | Description |
---|---|
System. |
NeedsResolveCastShadow
Gets or sets flag Needs
Declaration
bool NeedsResolveCastShadow { get; set; }
Property Value
Type | Description |
---|---|
System. |
NeedsUpdate
Gets or sets how often the entity should be updated.
Declaration
MyEntityUpdateEnum NeedsUpdate { get; set; }
Property Value
Type | Description |
---|---|
My |
NeedsWorldMatrix
Gets or sets if World
Declaration
bool NeedsWorldMatrix { get; set; }
Property Value
Type | Description |
---|---|
System. |
Remarks
Enabling it on big amount entities may lower simulation speed
Parent
Gets parent of entity or null, if this entity doesn't have parent. Ex: character sitting in cockpit, has parent - cockpit, cockpit has parent - cube grid, connected grids also has main grid, which would be parent for other grids.
Declaration
IMyEntity Parent { get; }
Property Value
Type | Description |
---|---|
IMy |
PersistentFlags
Gets or sets persistent flags that are used in rendering.
Declaration
MyPersistentEntityFlags2 PersistentFlags { get; set; }
Property Value
Type | Description |
---|---|
My |
Physics
Gets or sets physics for object
Declaration
MyPhysicsComponentBase Physics { get; set; }
Property Value
Type | Description |
---|---|
My |
PositionComp
Gets or sets position provider logic
Declaration
MyPositionComponentBase PositionComp { get; set; }
Property Value
Type | Description |
---|---|
My |
Render
Gets or sets render logic
Declaration
MyRenderComponentBase Render { get; set; }
Property Value
Type | Description |
---|---|
My |
Save
Declaration
bool Save { get; set; }
Property Value
Type | Description |
---|---|
System. |
ShadowBoxLod
Gets or sets flag Shadow
Declaration
bool ShadowBoxLod { get; set; }
Property Value
Type | Description |
---|---|
System. |
SkipIfTooSmall
Gets or sets flag Skip
Declaration
bool SkipIfTooSmall { get; set; }
Property Value
Type | Description |
---|---|
System. |
StopPhysicsActivation
Declaration
bool StopPhysicsActivation { get; set; }
Property Value
Type | Description |
---|---|
System. |
Storage
Custom storage for mods. Shared with all mods.
Declaration
MyModStorageComponentBase Storage { get; set; }
Property Value
Type | Description |
---|---|
My |
Remarks
Not synced, but saved with blueprints. Only use set accessor if value is null.
Entity.Storage = new MyModStorageComponent();
Synchronized
Gets or sets if the entity should be synced.
Declaration
bool Synchronized { get; set; }
Property Value
Type | Description |
---|---|
System. |
SyncObject
Gets SyncObject used for synchronizing data over network with VRage.Sync.Sync
Declaration
MySyncComponentBase SyncObject { get; }
Property Value
Type | Description |
---|---|
My |
Transparent
Gets or sets Transparency. When setting true entity would be 25% transparent
Declaration
bool Transparent { get; set; }
Property Value
Type | Description |
---|---|
System. |
Visible
Gets or sets flag Visible
Declaration
bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System. |
WorldMatrix
Gets or sets world matrix.
Declaration
MatrixD WorldMatrix { get; set; }
Property Value
Type | Description |
---|---|
Matrix |
See Also
WorldMatrixInvScaled
Get scaled, inverted world matrix. Same as Get
Declaration
MatrixD WorldMatrixInvScaled { get; }
Property Value
Type | Description |
---|---|
Matrix |
Matrix |
WorldMatrixNormalizedInv
Get normalized, inverted world matrix. Same as Get
Declaration
MatrixD WorldMatrixNormalizedInv { get; }
Property Value
Type | Description |
---|---|
Matrix |
Matrix |
Methods
AddToGamePruningStructure()
Declaration
void AddToGamePruningStructure()
BeforeSave()
Called before method GetObjectBuilder, when saving sector
Declaration
void BeforeSave()
Close()
This method marks this entity for close which means, that Close will be called after all entities are updated
Declaration
void Close()
DebugDraw()
Calls debug draw of entity
Declaration
void DebugDraw()
DebugDrawInvalidTriangles()
Calls special debug draw, that highlighting invalid triangles in model
Declaration
void DebugDrawInvalidTriangles()
Delete()
Performs real cleaning of entity. Should be called by game. Modders should prefer Close() method.
Declaration
void Delete()
DoOverlapSphereTest(Single, Vector3D)
Checks if intersects Works only with IMy
Declaration
bool DoOverlapSphereTest(float sphereRadius, Vector3D spherePos)
Parameters
Type | Name | Description |
---|---|---|
System. |
sphereRadius | Radius of sphere |
Vector3D | spherePos | World position |
Returns
Type | Description |
---|---|
System. |
True if intersects |
EnableColorMaskForSubparts(Boolean)
Allows subparts have different color than their parent
Declaration
void EnableColorMaskForSubparts(bool enable)
Parameters
Type | Name | Description |
---|---|---|
System. |
enable |
GetChildren(List<IMyEntity>, Func<IMyEntity, Boolean>)
Gets children of entity. Child - entity, who's Parent is this entity
Declaration
void GetChildren(List<IMyEntity> children, Func<IMyEntity, bool> collect = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
children | List, that would receive results |
System. |
collect | When returns true - child added to list |
GetDiffuseColor()
Gets render diffuse color
Declaration
Vector3 GetDiffuseColor()
Returns
Type | Description |
---|---|
Vector3 | Diffuse color |
GetDistanceBetweenCameraAndBoundingSphere()
Distance from camera to bounding sphere of this phys object. Result is always positive, even if camera is inside the sphere. (in meters)
Declaration
float GetDistanceBetweenCameraAndBoundingSphere()
Returns
Type | Description |
---|---|
System. |
Distance in meters |
GetDistanceBetweenCameraAndPosition()
Distance from camera to position of entity.
Declaration
float GetDistanceBetweenCameraAndPosition()
Returns
Type | Description |
---|---|
System. |
Distance in meters |
GetFriendlyName()
Not used. Actually not a friendly name
Declaration
string GetFriendlyName()
Returns
Type | Description |
---|---|
System. |
String.Empty or "MyVoxelMap" |
GetIntersectionWithAABB(ref BoundingBoxD)
Return true if object intersects specified bounding box.
Declaration
bool GetIntersectionWithAABB(ref BoundingBoxD aabb)
Parameters
Type | Name | Description |
---|---|---|
Bounding |
aabb | Bounding box to check |
Returns
Type | Description |
---|---|
System. |
True if intersects |
GetIntersectionWithLine(ref LineD, out Nullable<MyIntersectionResultLineTriangleEx>, IntersectionFlags)
Get intersection of model with provided line
Declaration
bool GetIntersectionWithLine(ref LineD line, out Nullable<MyIntersectionResultLineTriangleEx> tri, IntersectionFlags flags)
Parameters
Type | Name | Description |
---|---|---|
Line |
line | Line that should intersect model |
System. |
tri | Returns model first triangle that intersects |
Intersection |
flags | Mode of work |
Returns
Type | Description |
---|---|
System. |
True when line intersects models |
GetIntersectionWithLineAndBoundingSphere(ref LineD, Single)
Calculates intersection of line with any bounding sphere in this model instance. Center of the bounding sphere will be returned. It takes boundingSphereRadiusMultiplier argument which serves for extending the influence (radius) for interaction with line.
Declaration
Nullable<Vector3D> GetIntersectionWithLineAndBoundingSphere(ref LineD line, float boundingSphereRadiusMultiplier)
Parameters
Type | Name | Description |
---|---|---|
Line |
line | Line to check |
System. |
boundingSphereRadiusMultiplier | Bounding sphere radius would be multiplied by this value |
Returns
Type | Description |
---|---|
System. |
Position of intersection if of line and bounding sphere |
GetIntersectionWithSphere(ref BoundingSphereD)
Return true if object intersects specified sphere.
Declaration
bool GetIntersectionWithSphere(ref BoundingSphereD sphere)
Parameters
Type | Name | Description |
---|---|---|
Bounding |
sphere | Sphere to check |
Returns
Type | Description |
---|---|
System. |
True if intersects |
GetInventory()
Simply get the MyInventoryBase component stored in this entity.
Declaration
IMyInventory GetInventory()
Returns
Type | Description |
---|---|
IMy |
Null, or first inventory |
GetInventory(Int32)
Search for inventory component with matching index.
Declaration
IMyInventory GetInventory(int index)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | Index of inventory, starting from 0 |
Returns
Type | Description |
---|---|
IMy |
Null, or inventory at matching index |
GetLargestDistanceBetweenCameraAndBoundingSphere()
Largest distance from camera to bounding sphere of this phys object. Result is always positive, even if camera is inside the sphere. It's actually distance between camera and opposite side of the sphere
Declaration
float GetLargestDistanceBetweenCameraAndBoundingSphere()
Returns
Type | Description |
---|---|
System. |
Distance in meters |
GetObjectBuilder(Boolean)
Returns object builder - object representing block state, and allows restore it. Used in game save, or syncing over network.
Declaration
MyObjectBuilder_EntityBase GetObjectBuilder(bool copy = false)
Parameters
Type | Name | Description |
---|---|---|
System. |
copy | When true, Name won't be saved. Copy true comes only from MyGridClipboard/MyFloatingObjectClipboard/MyVoxelClipboard |
Returns
Type | Description |
---|---|
My |
Object builder |
GetSmallestDistanceBetweenCameraAndBoundingSphere()
Smallest distance between camera and bounding sphere of this phys object. Result is always positive, even if camera is inside the sphere.
Declaration
float GetSmallestDistanceBetweenCameraAndBoundingSphere()
Returns
Type | Description |
---|---|
System. |
Distance in meters |
GetSubpart(String)
Gets subpart by subpart name
Declaration
MyEntitySubpart GetSubpart(string name)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | Name of subpart. Keep in mind that subpart names, should not start with |
Returns
Type | Description |
---|---|
My |
Subpart if it is found, or crashes if subpart not found |
Remarks
If you press Alt+11, enable Debug draw
and Model dummies
then you'll see all subpart names.
GetTopMostParent(Type)
Gets top most Parent of specified type. Top most is entity that doesn't have parent (of specified type)
Declaration
IMyEntity GetTopMostParent(Type type = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | Type of parent. When type is null, type check disabled |
Returns
Type | Description |
---|---|
IMy |
Entity |
GetTrianglesIntersectingSphere(ref BoundingSphere, Nullable<Vector3>, Nullable<Single>, List<MyTriangle_Vertex_Normals>, Int32)
Return list of triangles intersecting specified sphere. Angle between every triangleVertexes normal vector and 'referenceNormalVector' is calculated, and if more than 'maxAngle', we ignore such triangleVertexes. Triangles are returned in 'retTriangles', and this list must be preallocated! IMPORTANT: Sphere must be in model space, so don't transform it!
Declaration
void GetTrianglesIntersectingSphere(ref BoundingSphere sphere, Nullable<Vector3> referenceNormalVector, Nullable<float> maxAngle, List<MyTriangle_Vertex_Normals> retTriangles, int maxNeighbourTriangles)
Parameters
Type | Name | Description |
---|---|---|
Bounding |
sphere | Sphere to check |
System. |
referenceNormalVector | Used in filtering triangles |
System. |
maxAngle | Max angle between referenceNormalVector and every triangleVertex of model |
System. |
retTriangles | Triangles would be added here |
System. |
maxNeighbourTriangles | Limit of added triangles |
GetViewMatrix()
Get normalized, inverted world matrix. Same as Get
Declaration
MatrixD GetViewMatrix()
Returns
Type | Description |
---|---|
Matrix |
Matrix |
GetWorldMatrixNormalizedInv()
Get normalized, inverted world matrix. Same as Get
Declaration
MatrixD GetWorldMatrixNormalizedInv()
Returns
Type | Description |
---|---|
Matrix |
Matrix |
IsVisible()
Gets or result of function Is
Declaration
bool IsVisible()
Returns
Type | Description |
---|---|
System. |
True if entity should be drawn |
OnAddedToScene(Object)
Adds entity to scene: init updates, render physics
Declaration
void OnAddedToScene(object source)
Parameters
Type | Name | Description |
---|---|---|
System. |
source | Object that triggered adding from scene |
OnRemovedFromScene(Object)
Remove entity and it's children from scene: stops updates and render, deactivates physics. Usually called when entity deleted
Declaration
void OnRemovedFromScene(object source)
Parameters
Type | Name | Description |
---|---|---|
System. |
source | Object that triggered removing from scene |
RemoveFromGamePruningStructure()
Declaration
void RemoveFromGamePruningStructure()
SetColorMaskForSubparts(Vector3)
Sets subparts custom col
Declaration
void SetColorMaskForSubparts(Vector3 colorMaskHsv)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | colorMaskHsv | Color |
SetEmissiveParts(String, Color, Single)
Sets the emissive value of a specific emissive material on entity.
Declaration
void SetEmissiveParts(string emissiveName, Color emissivePartColor, float emissivity)
Parameters
Type | Name | Description |
---|---|---|
System. |
emissiveName | The name of the emissive material (ie. "Emissive0") |
Color | emissivePartColor | Color to emit |
System. |
emissivity | Level of emissivity (0 is off, 1 is full brightness) |
SetEmissivePartsForSubparts(String, Color, Single)
Sets the emissive value of a specific emissive material on all entity subparts.
Declaration
void SetEmissivePartsForSubparts(string emissiveName, Color emissivePartColor, float emissivity)
Parameters
Type | Name | Description |
---|---|---|
System. |
emissiveName | The name of the emissive material (ie. "Emissive0") |
Color | emissivePartColor | Color to emit |
System. |
emissivity | Level of emissivity (0 is off, 1 is full brightness). |
SetLocalMatrix(Matrix, Object)
Sets local matrix. When entity, has parent, it's world coordinates are calculated from localMatrix and parent world matrix
Declaration
void SetLocalMatrix(Matrix localMatrix, object source = null)
Parameters
Type | Name | Description |
---|---|---|
Matrix | localMatrix | New matrix |
System. |
source | Object that caused this event. Not used in anyway |
SetPosition(Vector3D)
Set WorldMatrix's Translation. Moves entity.
Declaration
void SetPosition(Vector3D pos)
Parameters
Type | Name | Description |
---|---|---|
Vector3D | pos | New position of entity |
SetTextureChangesForSubparts(Dictionary<String, MyTextureChange>)
This calling is obsolete, use another version.
Declaration
void SetTextureChangesForSubparts(Dictionary<string, MyTextureChange> value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value |
SetTextureChangesForSubparts(Dictionary<MyStringId, MyTextureChange>)
Sets subparts custom skinning. Copy values from Texture
MyDefinitionManager.Static.GetAssetModifierDefinitionForRender(skinId);
Declaration
void SetTextureChangesForSubparts(Dictionary<MyStringId, MyTextureChange> value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | Key - name of texture, value - path to texture files |
SetWorldMatrix(MatrixD, Object)
Sets world matrix of entity.
Declaration
void SetWorldMatrix(MatrixD worldMatrix, object source = null)
Parameters
Type | Name | Description |
---|---|---|
Matrix |
worldMatrix | New world matrix |
System. |
source | Object that triggered set of new matrix |
Teleport(MatrixD, Object, Boolean)
When moving entity over large distances or when entity has children, using this method preferred over Set
Declaration
void Teleport(MatrixD pos, object source = null, bool ignoreAssert = false)
Parameters
Type | Name | Description |
---|---|---|
Matrix |
pos | Teleport destination |
System. |
source | Object that triggered |
System. |
ignoreAssert | Do extra validation |
TryGetSubpart(String, out MyEntitySubpart)
Gets subpart by subpart name
Declaration
bool TryGetSubpart(string name, out MyEntitySubpart subpart)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | Name of subpart. Keep in mind that subpart names, should not start with |
My |
subpart | Subpart if it is found |
Returns
Type | Description |
---|---|
System. |
True if subpart is found |
Remarks
If you press Alt+11, enable Debug draw
and Model dummies
then you'll see all subpart names.
UpdateGamePruningStructure()
Update position of entity in MyGamePruningStructure. Calls:
MyGamePruningStructure.Move(this)
Declaration
void UpdateGamePruningStructure()
Events
OnClose
Called when Close() is called. Order 1) On
Declaration
event Action<IMyEntity> OnClose
Event Type
Type | Description |
---|---|
System. |
Remarks
Modders should prefer On
OnClosing
Called when Close() is called. Order 1) On
Declaration
event Action<IMyEntity> OnClosing
Event Type
Type | Description |
---|---|
System. |
Remarks
Modders should prefer On
OnMarkForClose
Called when Close() is called. Order 1) On
Declaration
event Action<IMyEntity> OnMarkForClose
Event Type
Type | Description |
---|---|
System. |
Remarks
Modders should prefer On
OnPhysicsChanged
Called when havok rigid body physics are changed: inited, closed, modified.
Declaration
event Action<IMyEntity> OnPhysicsChanged
Event Type
Type | Description |
---|---|
System. |