Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
colliderGroup.colliders.forEach((collider) => {
g.addCollider(
// Unity 座標系からの変換のため X, Z 軸を反転
new Vector3(-collider.offset.x, collider.offset.y, -collider.offset.z),
collider.radius,
);
});
colliderGroups.push(g);
alpha={-Math.PI / 2} beta={(0.5 + (Math.PI / 4))}
radius={2} minZ={0.001} wheelPrecision={50} />
)
}
}
function getHighlightMesh(rendering) {
var m = rendering._highlightMesh
if (!m) {
var mesh = Mesh.CreatePlane("highlight", 1.0, rendering._scene)
var hlm = rendering.makeStandardMaterial('highlightMat')
hlm.backFaceCulling = false
hlm.emissiveColor = new Color3(1, 1, 1)
hlm.alpha = 0.2
mesh.material = hlm
m = rendering._highlightMesh = mesh
// outline
var s = 0.5
var lines = Mesh.CreateLines("hightlightLines", [
new Vector3(s, s, 0),
new Vector3(s, -s, 0),
new Vector3(-s, -s, 0),
new Vector3(-s, s, 0),
new Vector3(s, s, 0)
], rendering._scene)
lines.color = new Color3(1, 1, 1)
lines.parent = mesh
rendering.addMeshToScene(m)
rendering.addMeshToScene(lines)
}
return m
}
function getHighlightMesh(rendering) {
var m = rendering._highlightMesh
if (!m) {
var mesh = Mesh.CreatePlane("highlight", 1.0, rendering._scene)
var hlm = rendering.makeStandardMaterial('highlightMat')
hlm.backFaceCulling = false
hlm.emissiveColor = new Color3(1, 1, 1)
hlm.alpha = 0.2
mesh.material = hlm
m = rendering._highlightMesh = mesh
// outline
var s = 0.5
var lines = Mesh.CreateLines("hightlightLines", [
new Vector3(s, s, 0),
new Vector3(s, -s, 0),
new Vector3(-s, -s, 0),
new Vector3(-s, s, 0),
new Vector3(s, s, 0)
], rendering._scene)
lines.color = new Color3(1, 1, 1)
lines.parent = mesh
rendering.addMeshToScene(m)
rendering.addMeshToScene(lines)
}
return m
}
var m = rendering._highlightMesh
if (!m) {
var mesh = Mesh.CreatePlane("highlight", 1.0, rendering._scene)
var hlm = rendering.makeStandardMaterial('highlightMat')
hlm.backFaceCulling = false
hlm.emissiveColor = new Color3(1, 1, 1)
hlm.alpha = 0.2
mesh.material = hlm
m = rendering._highlightMesh = mesh
// outline
var s = 0.5
var lines = Mesh.CreateLines("hightlightLines", [
new Vector3(s, s, 0),
new Vector3(s, -s, 0),
new Vector3(-s, -s, 0),
new Vector3(-s, s, 0),
new Vector3(s, s, 0)
], rendering._scene)
lines.color = new Color3(1, 1, 1)
lines.parent = mesh
rendering.addMeshToScene(m)
rendering.addMeshToScene(lines)
}
return m
}
render () {
let baseUrl = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/'
return (
Rendering.prototype.prepareChunkForRendering = function (chunk) {
var cs = chunk.size
var min = new Vector3(chunk.x, chunk.y, chunk.z)
var max = new Vector3(chunk.x + cs, chunk.y + cs, chunk.z + cs)
chunk.octreeBlock = new OctreeBlock(min, max, undefined, undefined, undefined, $ => {})
this._octree.blocks.push(chunk.octreeBlock)
}
public getFirstPersonCameraPosition(): Nullable {
const firstPersonBone = this.getFirstPersonBone();
if (!firstPersonBone) {
return null;
}
let basePos = firstPersonBone.getAbsolutePosition();
const offsetPos = this.ext.firstPerson.firstPersonBoneOffset;
return new Vector3(
basePos.x + offsetPos.x,
basePos.y + offsetPos.y,
basePos.z + offsetPos.z,
);
}
public static multiplyWithVector3(quat: Quaternion, vec: Vector3): Vector3 {
const num = quat.x * 2;
const num2 = quat.y * 2;
const num3 = quat.z * 2;
const num4 = quat.x * num;
const num5 = quat.y * num2;
const num6 = quat.z * num3;
const num7 = quat.x * num2;
const num8 = quat.x * num3;
const num9 = quat.y * num3;
const num10 = quat.w * num;
const num11 = quat.w * num2;
const num12 = quat.w * num3;
const result = new Vector3();
result.x = (1 - (num5 + num6)) * vec.x + (num7 - num12) * vec.y + (num8 + num11) * vec.z;
result.y = (num7 + num12) * vec.x + (1 - (num4 + num6)) * vec.y + (num9 - num10) * vec.z;
result.z = (num8 - num11) * vec.x + (num9 + num10) * vec.y + (1 - (num4 + num5)) * vec.z;
return result;
}