# Primitive

### Primitive

`prim.Address` (number): The raw memory address of this primitive.

```lua
local prim = part:Primitive()
print(prim.Address)
```

`prim:Position()`: Returns the current world position of the part as a `Vector3`.

```lua
local pos = prim:Position()
print(pos.x, pos.y, pos.z)
```

`prim:SetPosition(Vector3)`: Sets the world position of the part.

```lua
prim:SetPosition(Vector3(0, 100, 0))
```

`prim:Size()`: Returns the size of the part as a `Vector3`.

```lua
local size = prim:Size()
print(size.x, size.y, size.z)
```

`prim:SetSize(Vector3)`: Sets the size of the part.

```lua
prim:SetSize(Vector3(10, 10, 10))
```

`prim:Velocity()`: Returns the current linear velocity of the part as a `Vector3`.

```lua
local vel = prim:Velocity()
print(vel.x, vel.y, vel.z)
```

`prim:SetVelocity(Vector3)`: Sets the linear velocity of the part.

```lua
prim:SetVelocity(Vector3(0, 50, 0))
```

`prim:Rotation()`: Returns a table of 9 floats representing the part's 3×3 rotation matrix in row-major order.

```lua
local rot = prim:Rotation()
print(rot[1], rot[2], rot[3])
print(rot[4], rot[5], rot[6])
print(rot[7], rot[8], rot[9])
```

`prim:RightVector()`: Returns the part's local right direction as a `Vector3`. Derived from the rotation matrix.

```lua
local right = prim:RightVector()
print(right.x, right.y, right.z)
```

`prim:UpVector()`: Returns the part's local up direction as a `Vector3`. Derived from the rotation matrix.

```lua
local up = prim:UpVector()
print(up.x, up.y, up.z)
```

`prim:LookVector()`: Returns the part's local forward direction as a `Vector3`. Derived from the rotation matrix.

```lua
local look = prim:LookVector()
print(look.x, look.y, look.z)
```

`prim:GetColor()`: Returns the part's current color as a `Color`.

```lua
local col = prim:GetColor()
print(col.r, col.g, col.b)
```

`prim:SetColor(color)`: Sets the part's color using a `Color`.

```lua
prim:SetColor(Color(255, 0, 0, 255))
```

`prim:Transparency()`: Returns the current transparency value between 0 and 1.

```lua
print(prim:Transparency())
```

`prim:SetTransparency(value)`: Sets the transparency. `0` is fully opaque, `1` is fully invisible.

```lua
prim:SetTransparency(0.5)
```

`prim:CanCollide()`: Returns whether collision is currently enabled for this part.

```lua
print(prim:CanCollide())
```

`prim:SetCanCollide(bool)`: Enables or disables collision for this part.

```lua
prim:SetCanCollide(false)
```

`prim:Material()`: Returns the material ID of the part as a number.

```lua
print(prim:Material())
```

`prim:SetMaterial(id)`: Sets the material by numeric ID.

```lua
prim:SetMaterial(256) -- SmoothPlastic
```

`prim:Anchored()`: Returns whether the part is currently anchored.

```lua
print(prim:Anchored())
```

`prim:SetAnchored(bool)`: Anchors or unanchors the part.

```lua
prim:SetAnchored(true)
```

`prim:CanQuery()`: Returns whether the part participates in spatial queries.

```lua
print(prim:CanQuery())
```

`prim:SetCanQuery(bool)`: Sets whether the part participates in spatial queries.

```lua
prim:SetCanQuery(false)
```

`prim:CanTouch()`: Returns whether the part fires touch events.

```lua
print(prim:CanTouch())
```

`prim:SetCanTouch(bool)`: Sets whether the part fires touch events.

```lua
prim:SetCanTouch(false)
```

`prim:AssemblyLinearVelocity()`: Returns the linear velocity of the entire assembly as a `Vector3`.

```lua
local vel = prim:AssemblyLinearVelocity()
print(vel.x, vel.y, vel.z)
```

`prim:SetAssemblyLinearVelocity(Vector3)`: Sets the linear velocity of the entire assembly.

```lua
prim:SetAssemblyLinearVelocity(Vector3(0, 100, 0))
```

`prim:AssemblyAngularVelocity()`: Returns the angular velocity of the entire assembly as a `Vector3`.

```lua
local avel = prim:AssemblyAngularVelocity()
print(avel.x, avel.y, avel.z)
```

`prim:SetReflectance(value)`: Sets the reflectance of the part. Value ranges from 0 to 1.

```lua
prim:SetReflectance(0.8)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yerba-1.gitbook.io/yerba-docs/api/primitive.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
