protected override void OnRender(Camera camera) { base.OnRender(camera); if ((EngineDebugSettings.DrawGameSpecificDebugGeometry || EngineApp.Instance.ApplicationType == EngineApp.ApplicationTypes.ResourceEditor || EngineApp.Instance.ApplicationType == EngineApp.ApplicationTypes.MapEditor || EngineApp.Instance.ApplicationType == EngineApp.ApplicationTypes.Simulation) && camera.Purpose == Camera.Purposes.MainCamera) { if (Active) { Vec3 min = Position + new Vec3(0, 0, 0); //min Vec3 max = Position + new Vec3(Type.BoxSize.X * BoxLength * Scale.X, Type.BoxSize.Y * BoxWidth * Scale.Y, Type.BoxSize.Z * BoxHeight * Scale.Z); //max Mat3 rotation = new Mat3(1, 0, 0, 0, 1, 0, 0, 0, 1); camera.DebugGeometry.Color = new ColorValue(0, 1, 0, .5f); bounds = new Bounds(min, max); box = new Box(bounds); box.Axis = rotation * Rotation.ToMat3(); box.Center = Position + new Vec3(0, 0, ((max.Z - min.Z) / 2) + .1f); box.Expand(.1f); camera.DebugGeometry.AddBox(box); } } }
/// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary> protected override void OnPostCreate(bool loaded) { base.OnPostCreate(loaded); if (EntitySystemWorld.Instance.IsServer()) { if (Active) { Vec3 min = Position + new Vec3(0, 0, 0); //min Vec3 max = Position + new Vec3(Type.BoxSize.X * BoxLength * Scale.X, Type.BoxSize.Y * BoxWidth * Scale.Y, Type.BoxSize.Z * BoxHeight * Scale.Z); //max Mat3 rotation = new Mat3(1, 0, 0, 0, 1, 0, 0, 0, 1); //camera.DebugGeometry.Color = new ColorValue(0, 1, 0, .5f); bounds = new Bounds(min, max); box = new Box(bounds); box.Axis = rotation * Rotation.ToMat3(); box.Center = Position + new Vec3(0, 0, ((max.Z - min.Z) / 2) + .1f); box.Expand(.1f); //camera.DebugGeometry.AddBox(box); } } SubscribeToTickEvent(); UpdateAttachedObjects(); }