BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Plane.translate()

The translate() method in Plane class allows you to move a plane along a specified direction vector by a specified distance.

Syntax

plane.translate( direction, distance )

Parameters

  • direction - A Vector3 object that represents the direction in which the plane needs to be translated.
  • distance - A number that defines the distance by which the plane needs to be translated along the direction vector.

Return Value

This method has no return value.

Description

Plane is a class in three.js that represents a 2D plane in 3D space. The translate method in this class modifies the position of the plane by moving it along a specified direction vector by a specified distance.

In simple terms, this method can be used to move an existing plane object in three-dimensional space. The direction of movement can be specified using a vector object, while the distance to be traveled can be specified using a numerical value.

The translate() method changes the position of the plane object, but does not change its orientation. This means that the plane object will continue to have the same normal vector direction before and after the translation.

Example

The following code snippet demonstrates how to use the translate() method to move a plane object in three-dimensional space.

const planeGeometry = new THREE.PlaneGeometry( 5, 5 );
const planeMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000 });
const plane = new THREE.Mesh( planeGeometry, planeMaterial );

// Move the plane up by 2 units
plane.translate( new THREE.Vector3( 0, 2, 0 ), 1 );

scene.add( plane );

In this example, a new Plane object is created using PlaneGeometry. The translate() method is then used to move the plane object upward by 2 units along the y-axis. The resulting plane object is then added to the scene.