How to use the @babylonjs/core.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 brianzinn / react-babylonjs / stories / babylonjs / 2-withVR / with2DGUI.stories.js View on Github external
{
              let { plane } = this.state

              if (plane) {
                let forwardRay = camera.getForwardRay()
                plane.position = camera.position.clone().add(forwardRay.direction.scale(1.5 / camera.fov /* * forwardRay.length */))
                plane.lookAt(camera.position, 0, Math.PI, Math.PI)
              }
            }}
          />
          
          
            
          
          
            
          
          
            
          
          {this.state.showModal === true &&
github brianzinn / react-babylonjs / stories / babylonjs / 2-withVR / with2DGUI.stories.js View on Github external
if (plane) {
                let forwardRay = camera.getForwardRay()
                plane.position = camera.position.clone().add(forwardRay.direction.scale(1.5 / camera.fov /* * forwardRay.length */))
                plane.lookAt(camera.position, 0, Math.PI, Math.PI)
              }
            }}
          />
          
          
            
          
          
            
          
          
            
          
          {this.state.showModal === true &&
github brianzinn / create-react-app-typescript-babylonjs / src / App.tsx View on Github external
const App: React.FC = () => {
  const sphereRef = useCallback(node => {
    sphere = node.hostInstance;
  }, []);

  return (
    <div>
      <header>
        <p>@babylonjs + `react-babylonjs`</p>
        
          
            
            
            
              
            
            
              
              
                
                  
                      
                        
                          
                        
                      
                  </header></div>
github brianzinn / react-babylonjs / stories / babylonjs / 3-physics / physics.stories.js View on Github external
radius={4} minZ={0.001} wheelPrecision={50} 
                        lowerRadiusLimit={8} upperRadiusLimit={20} upperBetaLimit={Math.PI / 2}
                        /&gt;
                    
                    
                    
                    
                    
                    
                    
                        
                        
                            
                                
                                
                                
github Beg-in / vue-babylonjs / src / scene / index.js View on Github external
      default: () => new Vector3(0, -9.81, 0),
    },
github brianzinn / react-babylonjs / stories / babylonjs / 4-advanced / nonDeclarative.stories.js View on Github external
function onSceneMount (e) {
  const { canvas, scene } = e

  scene.clearColor = new Color3(0.5, 0.5, 0.5)
  var camera = new FreeCamera('camera1', new Vector3(0, 0.3, -0.7), scene)
  camera.speed = 0.01
  camera.minZ = 0.001
  scene.activeCameras.push(camera)
  camera.attachControl(canvas, true)
  var light = new HemisphericLight('light1', new Vector3(0, 1, 0), scene)
  light.intensity = 0.7
  var pbr = new PBRMetallicRoughnessMaterial('pbr', scene)
  pbr.environmentTexture = CubeTexture.CreateFromPrefilteredData('assets/textures/environment.dds', scene)
  var gridSize = 4
  for (var i = 0; i &lt; gridSize; i++) {
    for (var j = 0; j &lt; 10; j++) {
      var sphereMat = pbr.clone()
      sphereMat.metallic = 0.1
      sphereMat.roughness = (i / gridSize) / 3
      sphereMat.baseColor = Color3.White().scale(1 - (j / 10))
      var sphere = Mesh.CreateSphere('sphere', 16, 0.2, scene)
      sphere.material = sphereMat
      sphere.position.y = i * 0.3
      sphere.position.x = 0.3
      sphere.position.z = j * 0.4
github brianzinn / create-react-app-typescript-babylonjs / src / App.tsx View on Github external
const App: React.FC = () =&gt; {
  const sphereRef = useCallback(node =&gt; {
    sphere = node.hostInstance;
  }, []);

  return (
    <div>
      <header>
        <p>@babylonjs + `react-babylonjs`</p>
        
          
            
            
            
              
            
            
              
              
                
                  
                      
                        </header></div>
github brianzinn / react-babylonjs / stories / babylonjs / 3-physics / physics.stories.js View on Github external
const BouncyPlayground = () =&gt; {
    const sphereRef = useCallback(node =&gt; {
        sphere = node.hostInstance;
    }, []);

    return (
        
            
            
github brianzinn / create-react-app-typescript-babylonjs / src / App.tsx View on Github external
<div>
      <header>
        <p>@babylonjs + `react-babylonjs`</p>
        
          
            
            
            
              
            
            
              
              
                
                  
                      
                        
                          
                        
                      
                  
                
              
            
            
            
              </header></div>