How to use the @babylonjs/core/Maths/math.Vector3 function in @babylonjs/core

To help you get started, we’ve selected a few @babylonjs/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github virtual-cast / babylon-vrm-loader / src / secondary-animation / spring-bone-controller.ts View on Github external
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);
github brianzinn / react-babylonjs / stories / babylonjs / 2-withVR / withVr.stories.js View on Github external
alpha={-Math.PI / 2} beta={(0.5 + (Math.PI / 4))}
            radius={2} minZ={0.001} wheelPrecision={50} />

          
            
          

          
            
            
          
          
          
            
            
          
          
          
        
      
    )
  }
}
github andyhall / noa / src / lib / rendering.js View on Github external
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
}
github andyhall / noa / src / lib / rendering.js View on Github external
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
}
github andyhall / noa / src / lib / rendering.js View on Github external
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
}
github brianzinn / react-babylonjs / stories / babylonjs / 2-withVR / withVr.stories.js View on Github external
render () {
    let baseUrl = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/'
    return (
      
        
          

          
            
          
github andyhall / noa / src / lib / rendering.js View on Github external
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)
}
github virtual-cast / babylon-vrm-loader / src / vrm-manager.ts View on Github external
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,
        );
    }
github virtual-cast / babylon-vrm-loader / src / secondary-animation / quaternion-helper.ts View on Github external
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;
    }