get
Problem it solves
You need to know the player's current looking direction or field of view to create sniper scope zoom mechanics.
What this block does
Retrieves the current numerical value of a render attribute like dirX, dirY, fov, or wallZScale.
The block
Block ID: rcRender_getAttribute
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| attr | attribute | The renderer attribute to read (dirX, dirY, fov, or wallZScale). |
Returns
number — The numerical value of the requested render attribute.
Example
let currentFov = Render.getAttribute(Render.attribute.fov)
Add the extension
Add github:The-Code-Zone/Raycasting-pxt-extension to your project, or open: Import Raycasting-pxt-extension.