1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e346a267956eb3479c89010979a5a83
|
||||
guid: d67461ea58a21334ea2488664d62f758
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
@@ -1,11 +1,10 @@
|
||||
{
|
||||
"name": "BITKit.Extensions.Polaris",
|
||||
"name": "Net.BITKit.Polaris.Support",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:9c184a1e5cc20654384071dfebc106ed",
|
||||
"GUID:bdb069e155d2f944cb1bf28602b6d4c1",
|
||||
"GUID:1193c2664d97cc049a6e4c486c6bce71"
|
||||
"GUID:39db31f0562d9184c92881e43adea352",
|
||||
"GUID:9c184a1e5cc20654384071dfebc106ed"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f23b1d01b5fa044784cf0a3dd9794eb
|
||||
guid: 8c05a2a2c7bf2c74c8639d3841c493d6
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
23
Src/UnityPluginsSupport/Polaris/PolarisCommand.cs
Normal file
23
Src/UnityPluginsSupport/Polaris/PolarisCommand.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MonKey;
|
||||
using Pinwheel.Griffin;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Net.Project.B.Po
|
||||
{
|
||||
public static class PolarisCommand
|
||||
{
|
||||
[Command(nameof(Shrinkwrap), "Shrinkwrap Terrain By Scene Colliders"), MenuItem("Tools/Terrain/Snrinkwrap")]
|
||||
public static void Shrinkwrap()
|
||||
{
|
||||
var terrain = Object.FindObjectOfType<GStylizedTerrain>();
|
||||
if (terrain is null)
|
||||
{
|
||||
Debug.LogError("未找到地形");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 196335990c4123f46b440b909e1536d3
|
||||
guid: 11baeb3f9cbfb344b9b855f9a79e1368
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@@ -1,59 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Pinwheel.Griffin;
|
||||
using Quadtree;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit.OpenWorld
|
||||
{
|
||||
public class PolarisTerrainChunkService : WorldChunkService<PolarisTerrainChunkService>
|
||||
{
|
||||
private class ChunkData:IWorldChunkObject
|
||||
{
|
||||
public Collider Collider { get; set; }
|
||||
public Bounds GetBounds() => Bounds;
|
||||
public Bounds Bounds { get; set; }
|
||||
public Node<IWorldChunkObject> ParentNode { get; set; }
|
||||
public void QuadTree_Root_Initialized(IQuadtreeRoot<IWorldChunkObject, Node<IWorldChunkObject>> root)
|
||||
{
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public int Lod
|
||||
{
|
||||
get => lod;
|
||||
set
|
||||
{
|
||||
Collider.enabled = value is 0;
|
||||
lod = value;
|
||||
}
|
||||
}
|
||||
private int lod=-1;
|
||||
}
|
||||
[SerializeField] private GStylizedTerrain[] terrains;
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
var reporter = new StringBuilder();
|
||||
foreach (var terrain in terrains)
|
||||
{
|
||||
reporter.AppendLine($"正在注册地形 {terrain.name},尺寸:{terrain.TerrainData.Geometry.Width}x{terrain.TerrainData.Geometry.Length}");
|
||||
foreach (var chunk in terrain.GetChunks())
|
||||
{
|
||||
var data =new ChunkData()
|
||||
{
|
||||
Collider = chunk.MeshColliderComponent,
|
||||
Bounds = chunk.MeshColliderComponent.bounds
|
||||
};
|
||||
data.Collider.enabled = false;
|
||||
Register(data);
|
||||
reporter.AppendLine($"注册地形碰撞体 {chunk.name},尺寸:{data.Bounds.size}");
|
||||
}
|
||||
}
|
||||
Debug.Log(reporter);
|
||||
OnTick(Time.deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user