BJ Patel is an expert user of Umbraco. Always keen to share hints and tips on getting the best out of Umbraco.
Creating Ground Plane
- Creating a Plane :
This code creates a flat plane (ground) with a size of 30x30 units, colored light gray, positioned below other objects in the scene. It's set to receive shadows to enhance realism. - Set Camera :
It sets the camera's position 5 units away from the center of the scene along the z-axis . This determines how far or close the camera is to the objects in the scene when rendering. Positive values move the camera away from the scene, while negative values move it closer. Adjusting this value changes the perspective of the scene when rendered.
// Creating Ground plane and adding it to the Scene
const groundGeometry = new THREE.PlaneGeometry( 30,30 );
const groundMaterial = new THREE.MeshStandardMaterial({
color: 0xdddddd });
const ground = new THREE.Mesh(groundGeometry,
groundMaterial);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -1.5;
ground.receiveShadow = true;
scene.add(ground);
//Setting up Camera Position
camera.position.z = 5;
comments powered by Disqus
Join Our Community
Join Our Community Become a part of our developer community. Share your projects, get feedback, and collaborate with like-minded individuals.
Your contributions help us continue creating valuable content. Consider supporting us by sharing our content.
Junagadh, Gujarat
Latest Blog Posts