27 array<ref SCR_BasePreviewEntry> entries = GetPreviewEntriesFromEntity(entity, spawnParams,
flags);
50 array<ref SCR_BasePreviewEntry> entries = {};
51 GetPreviewEntries(entity, entries, spawnParams.Transform, -1,
flags, trace);
94 entry.m_iParentID = parentID;
95 parentID = outEntries.Insert(entry);
97 entry.m_Entity = entity;
98 entry.SaveTransform(transform);
109 SCR_HorizontalAlignComponent horizontalComponent = SCR_HorizontalAlignComponent.Cast(entity.
FindComponent(SCR_HorizontalAlignComponent));
110 if (horizontalComponent)
121 GetPreviewEntries(child, outEntries, rootTransform, parentID,
flags, trace);
142 if (pivotIndex == -1)
148 array<string> boneNames = {};
149 anim.GetBoneNames(boneNames);
150 for (
int i = 0, count = boneNames.Count(); i < count; i++)
152 if (anim.GetBoneIndex(boneNames[i]) == pivotIndex)
160 SCR_BaseAreaMeshComponent areaMeshComponent = SCR_BaseAreaMeshComponent.Cast(entity.
FindComponent(SCR_BaseAreaMeshComponent));
161 if (areaMeshComponent)
171 areaMeshComponent.GetDimensions3D(entry.m_vScale);
177 SCR_PreviewEntityComponent previewComponent = SCR_PreviewEntityComponent.Cast(entity.
FindComponent(SCR_PreviewEntityComponent));
178 if (previewComponent && previewComponent.IsRuntime())
181 if (previewComponent.GetPreviewEntries(outEntries, entry) != 0)
185 entry.m_Mesh = previewComponent.GetPreviewPrefab();
194 entry.m_Mesh = meshObject.GetResourceName();
202 vector worldTransform[4], terrainTransform[4], surfaceBasis[4];
216 Math3D.MatrixMultiply3(surfaceBasis, terrainTransform, terrainTransform);
219 Math3D.MatrixInvMultiply3(terrainTransform, worldTransform, terrainTransform);
220 entry.m_vAnglesTerrain =
Math3D.MatrixToAngles(terrainTransform);
221 entry.m_fHeightTerrain = worldTransform[3][1] - surfaceBasis[3][1];
225 if (
SCR_Math3D.IsMatrixIdentity(rootTransform))
228 Math3D.MatrixCopy(transform, rootTransform);
229 Math3D.MatrixIdentity4(transform);
233 if (
float.AlmostEqual(
Math.AbsFloat(
angles[1]), 90))
242 Math3D.MatrixInvMultiply4(rootTransform, transform, transform);
SCR_EAIThreatSectorFlags flags
ref array< string > angles
void SpawnPreview()
Create a preview if it does not exist.
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
proto external EntityFlags GetFlags()
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external Managed FindComponent(typename typeName)
proto external float GetScale()
proto external IEntity GetChildren()
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
proto external Animation GetAnimation()
proto external BaseWorld GetWorld()
proto external IEntity GetParent()
proto external TNodeId GetPivot()
Returns pivot ID from hierarchy component.
proto external IEntity GetSibling()
proto external VObject GetVObject()
Returns visual object set to this Entity. No reference is added.
proto external void GetLocalTransform(out vector mat[])
See IEntity::GetTransform.
void SCR_BasePreviewEntity(IEntitySource src, IEntity parent)
static string GetPivotName(IEntity entity)
static float GetLocalScale(IEntity entity)
static bool GetMesh(IEntity entity, EPreviewEntityFlag flags, SCR_BasePreviewEntry entry, out notnull array< ref SCR_BasePreviewEntry > outEntries)
static void SaveTerrainTransform(IEntity entity, SCR_BasePreviewEntry entry, bool isUnderwater=false, TraceParam trace=null)
static void SaveRootTransform(out vector transform[4], out vector rootTransform[4])
Contains various scripted 3D math functions.
Entity composition which is supposed to fit into a slot.
bool CanOrientChildrenToTerrain()
static bool GetTerrainBasis(vector pos, out vector result[4], BaseWorld world=null, bool noUnderwater=false, TraceParam trace=null)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
EntityFlags
Various entity flags.
int TNodeId
Node global id is a hash of name of the node.
proto native vector Vector(float x, float y, float z)