Working with Components
Add interactivity using built-in and custom components
Components are the building blocks of interactivity in Needle Engine. Add them to objects in Blender to create interactive behaviors, from simple camera controls to complex game mechanics.
Built-in Components
Needle Engine includes 100+ ready-to-use components for common interactive features.
Adding Components
In Blender:
Select an object in your scene
Open the Needle Components panel (usually in the Properties area)
Click
Add ComponentSearch for and select the component you need
Adjust component settings in the panel
Component settings appear immediately after adding. Each component has different properties you can configure directly in Blender.
Example: Camera Controls
Add OrbitControls to your camera for instant mouse/touch controls on all devices:
OrbitControls settings:
target- What the camera orbits aroundautoRotate- Automatic rotationenableDamping- Smooth camera movementminDistance/maxDistance- Zoom limitsenablePan- Allow panning with right-click
Popular Components by Category
Camera Controls:
OrbitControls- Orbit around a target with mouse/touch
Animation:
Animation- Play animation clipsAnimator- State machine animationsPlayableDirector- Timeline-based sequences
Interaction:
DragControls- Make objects draggable in 3D spaceObjectRaycaster- Detect clicks and hover on objects
UI & UX:
Button- Interactive buttonsCanvas- UI container
Media:
VideoPlayer- Play video files and streams
Physics:
Rigidbody- Add physics simulationBoxCollider/SphereCollider/MeshCollider- Collision shapes
Audio:
AudioSource- 3D spatial audioAudioListener- Hear 3D audio (usually on camera)
Effects:
ParticleSystem- Visual effectsLight- Dynamic lighting
Optimization:
ViewBox- Ensure content stays framed
XR (Virtual & Augmented Reality):
WebXR- Enable VR/AR with one click
Actions & Events:
EverywhereActions- Trigger actions on various events (click, hover, collision, etc.)
Removing Components
Click the X button in the lower right of any component panel.
Custom Components
Want behavior that doesn't exist yet? Write your own TypeScript components that automatically appear in Blender.
Creating Custom Components
1. Open Your Project Code
Click Code Editor in the Needle Project panel to open VS Code with your web project.
2. Create a Component File
In your project, navigate to src/scripts/ and create a new .ts file (e.g., RotateObject.ts).
3. Write Your Component
4. Save and Use
Save the file
The component automatically compiles
It appears in Blender's component list
Add it to objects just like built-in components
Your
@serializable()properties appear as editable fields in Blender
Component Lifecycle
Components have lifecycle methods you can override:
Learn more about lifecycle hooks →
Accessing Other Components
Find components on the same object:
Find components in children:
Find components in parents:
Find components anywhere in scene:
Learn more about finding objects and components →
Serializable Properties
Use @serializable() to expose properties in Blender:
All these properties become editable in Blender's component panel!
:::tip Learn More
Component Communication
Using Events:
In Blender, assign the Door's open() method to the Button's onClick event.
Direct References:
Assign the animator reference in Blender by dragging the component.
Best Practices
Component Design:
Keep components small and focused (single responsibility)
Use
@serializable()for values artists should controlProvide sensible defaults
Add comments to explain parameters
Performance:
Avoid heavy calculations in
update()- useonEnable()when possibleCache component references in
awake()orstart()Use object pooling for frequently created/destroyed objects
Organization:
Group related components in the same file or folder
Use clear, descriptive class names
Follow TypeScript naming conventions
Requirements
:::warning Component Compiler Required Make sure @needle-tools/needle-component-compiler 2.x is in your package.json devDependencies for component hot-reloading to work. :::
This is included by default in new projects. If components aren't appearing in Blender, check your package.json.
Next Steps
Create Components Guide - Detailed scripting tutorial
Component API Reference - Complete API documentation
Animation Workflows - Use animation components
TypeScript Essentials - Learn TypeScript basics
Need Help?
Discord Community - Ask about component development
Forum - Share your custom components
Component Catalog - Browse all built-in components
Last updated