Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
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 &&
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 &&
const App: React.FC = () => {
const sphereRef = useCallback(node => {
sphere = node.hostInstance;
}, []);
return (
<div>
<header>
<p>@babylonjs + `react-babylonjs`</p>
</header></div>
radius={4} minZ={0.001} wheelPrecision={50}
lowerRadiusLimit={8} upperRadiusLimit={20} upperBetaLimit={Math.PI / 2}
/>
default: () => new Vector3(0, -9.81, 0),
},
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 < gridSize; i++) {
for (var j = 0; j < 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
const App: React.FC = () => {
const sphereRef = useCallback(node => {
sphere = node.hostInstance;
}, []);
return (
<div>
<header>
<p>@babylonjs + `react-babylonjs`</p>
</header></div>
const BouncyPlayground = () => {
const sphereRef = useCallback(node => {
sphere = node.hostInstance;
}, []);
return (
render () {
return (
)
}
}
<div>
<header>
<p>@babylonjs + `react-babylonjs`</p>
</header></div>