API reference
API reference
Select your platform
No SDKs available
No versions available

Text3D Object

Builder for text3d mesh URIs. Encodes text rendering parameters as URI query params for use with the mesh://text3d mesh creator.
Example:
val uri = Text3D.create("Hello World")
Entity.create(listOf(Mesh(uri), Material(), Transform(Pose(position))))
// With all parameters:
val uri = Text3D.create(
    text = "Score: 100",
    fontSize = 0.15f,
    depth = 0.03f,
    fontFamily = "sans-serif",
    letterSpacing = 0.01f,
)

Signature

object Text3D

Properties

BASE_URI : String
[Get]
Base URI for the text3d mesh creator.
Signature
const val BASE_URI: String
DEFAULT_CURVE_SEGMENTS : Int
[Get]
Default number of line segments per Bezier curve segment.
Signature
const val DEFAULT_CURVE_SEGMENTS: Int = 4
DEFAULT_DEPTH : Float
[Get]
Default extrusion depth in meters.
Signature
const val DEFAULT_DEPTH: Float = 0.02f
DEFAULT_FONT_FAMILY : String
[Get]
Default font family.
Signature
const val DEFAULT_FONT_FAMILY: String
DEFAULT_FONT_SIZE : Float
[Get]
Default font size in meters.
Signature
const val DEFAULT_FONT_SIZE: Float = 0.1f
DEFAULT_LETTER_SPACING : Float
[Get]
Default letter spacing in meters.
Signature
const val DEFAULT_LETTER_SPACING: Float = 0.0f

Methods

create ( text , fontSize , depth , fontFamily , letterSpacing , curveSegments )
Creates a mesh URI for 3D extruded text.
Signature
fun create(text: String, fontSize: Float = DEFAULT_FONT_SIZE, depth: Float = DEFAULT_DEPTH, fontFamily: String = DEFAULT_FONT_FAMILY, letterSpacing: Float = DEFAULT_LETTER_SPACING, curveSegments: Int = DEFAULT_CURVE_SEGMENTS): Uri
Parameters
text: String  The text string to render
fontSize: Float  Height of the text in meters (default 0.1m = 10cm)
depth: Float  Extrusion depth in meters (default 0.02m = 2cm)
fontFamily: String  Android font family name (default "sans-serif")
letterSpacing: Float  Additional letter spacing in meters (default 0)
curveSegments: Int  Curve approximation quality: segments per Bezier (default 4)
Returns
Uri  A Uri suitable for use with the Mesh component