Skip to main content

<Align/>

The <Align/> component is a simple container that positions an entity relative to its parent. This can be useful when using 3D assets that are offset from the origin. Sometimes, you just want to sit the asset on the ground, or align it with the camera.

The <Align/> component accepts the following props: top, bottom, left, right, front, back.

Usage

This example will align the asset to the bottom right of the parent entity.

import{Entity}from'@playcanvas/react'
import{Align,Render}from'@playcanvas/react/components'

exportdefaultfunctionScene(){
return(
<Entity>
<Alignbottomright>
<Rendertype="box"/>
</Align>
</Entity>
)
}

Properties

NameTypeDefault
left?
boolean
-
right?
boolean
-
top?
boolean
-
bottom?
boolean
-
front?
boolean
-
back?
boolean
-
children?
ReactNode
-

AltStyle によって変換されたページ (->オリジナル) /