Redirect Component
The Redirect component handles external URL redirection when triggered by events in your Hyperfy world. Think of it as a web browser controller that can open websites, external resources, or redirect players to different online locations when specific events occur.
Important: This component opens external URLs in new browser windows/tabs when triggered. It's designed for linking to external websites, documentation, social media, or other web resources from within your Hyperfy world.
What Does It Do?
The Redirect component is like having a web browser controller for your 3D world. You can:
- Open external websites when players interact with objects
- Link to documentation or help resources
- Connect to social media or community platforms
- Redirect to external services like payment processors or forms
- Create interactive links that respond to player actions
- Sync redirections across all players in multiplayer environments
- Chain actions by triggering other components when redirections occur
Important: This component opens URLs in new browser windows/tabs, so players won't lose their place in your Hyperfy world. The redirection happens instantly when triggered by events.
Video Demo
Watch the Redirect component in action: opening external websites, linking to resources, and synchronized redirections across all players.
Properties
Basic Settings
| Property | Type | Default | Description |
|---|---|---|---|
App ID | text | Auto | Unique name for this component (auto-generated) |
Node Name | text | "" | Required: Name of the 3D object in your scene |
Debug Logs | toggle | false | Show detailed information for troubleshooting |
Add Collision | toggle | true | Make the object solid (players can't walk through) |
Start Visible | toggle | true | Should the object be visible when the scene loads? |
Redirect Settings
| Property | Type | Default | Description |
|---|---|---|---|
Sync Changes | toggle | false | Should all players see redirections at the same time? |
Use Delay | toggle | false | Add a wait time before opening URLs? |
Delay (sec) | number | 0 | How many seconds to wait before opening URL (0.1 to 60) |
Target URL | text | "" | Required: The URL to redirect to |
Accept Any Event | toggle | false | Listen to any signal sent to this component? |
Event Listeners | textarea | [] | List of events that trigger redirections |
How Events Work
The Redirect component listens for "signals" (events) from other components. When it receives a signal, it opens the configured URL in a new browser window/tab. The component uses its unique App ID (generated by Hyperfy) to identify itself in the event system.
Event Format
In the Event Listeners field, you can specify events like this:
[
{
"id": "a1b2c3d4e",
"actions": [
{
"type": "redirect",
"params": {
"url": "https://example.com",
"delay": 1.5
}
}
]
}
]
Note: When referencing this component in events from other components, use the App ID that Hyperfy generated for this component. Also, when duplicating components, be sure you make the app unique, so it has a new AppID.
Action Types
| Action | Description | Parameters |
|---|---|---|
redirect | Open URL in new browser window/tab | url, delay |
Event Parameters
When an event triggers a redirection, you can control:
| Parameter | Type | Description |
|---|---|---|
url | string | The URL to redirect to (overrides Target URL setting) |
delay | number | Seconds to wait before opening URL |
Common Use Cases
1. Help Documentation
- Object: A help button or info panel
- Event: Player clicks help button
- Action: Opens documentation website in new tab
2. Social Media Links
- Object: Social media buttons
- Event: Player interacts with social button
- Action: Opens social media page in new tab
3. External Services
- Object: Payment or service buttons
- Event: Player needs to make payment
- Action: Opens payment processor website
4. Community Links
- Object: Community hub or forum buttons
- Event: Player wants to join community
- Action: Opens community website
5. Resource Links
- Object: Resource or download buttons
- Event: Player needs additional resources
- Action: Opens resource website
Step-by-Step Setup
1. Add the Component
- Drag the Redirect component into your scene
- Select the 3D object you want to associate with redirection
2. Configure Basic Settings
- Set the
Node Nameto match your 3D object's name - Choose if the object should
Start Visible - Decide if it should
Add Collision(be solid)
3. Set Up Redirect Parameters
- Enter your
Target URL(the website to redirect to) - Enable
Sync Changesif all players should see redirections - Set
Use DelayandDelay (sec)for timed redirections
4. Configure Events
- In
Event Listeners, add the events that should trigger redirections - Use the JSON format shown above
- Replace event names with actual events from other components
5. Test Your Setup
- Enable
Debug Logsto see what's happening - Trigger your events and watch URLs open
- Check that all players see the same redirections
Tips for Designers
Choosing Good URLs
- Use complete URLs with https:// protocol
- Test URLs to ensure they work correctly
- Consider mobile-friendly websites
- Avoid URLs that might be blocked by browsers
Planning Your Redirect System
- Think about when players should see external links
- Consider timing and delays for dramatic effects
- Plan for both single-player and multiplayer scenarios
- Design clear visual cues for redirectable objects
Testing Your Setup
- Always test with multiple players
- Use debug logs to troubleshoot issues
- Test edge cases (what happens if players disconnect?)
- Verify URLs open correctly in different browsers
Performance Considerations
- Redirections are instant - no performance impact
- Consider the impact on player experience
- Test with different network conditions
Troubleshooting
URL Not Opening
- Check that the
Target URLis complete and valid - Verify that the event is being sent correctly
- Enable
Debug Logsto see what's happening - Test the URL manually in a browser
Redirections Not Syncing
- Make sure
Sync Changesis enabled - Check that the event includes proper parameters
- Verify all players are connected
- Test with simple events first
Delays Not Working
- Ensure
Use Delayis enabled - Check that
Delay (sec)is greater than 0 - Verify the delay value in your event parameters
- Remember: delays only postpone the instant redirection
Events Not Triggering
- Check that the event
idmatches exactly - Verify the Event Listeners JSON format is correct
- Test with
Accept Any Eventenabled - Use debug logs to see event reception
URL Blocked by Browser
- Ensure URLs use https:// protocol
- Check for popup blockers
- Test with different browsers
- Consider using trusted domains
Best Practices
- Start Simple: Test with basic redirections before adding complexity
- Use Valid URLs: Ensure all URLs are complete and accessible
- Plan for Multiplayer: Consider how redirections affect all players
- Add Delays: Use delays for smoother, more professional experiences
- Test Thoroughly: Always test with multiple players and scenarios
- Use Debug Logs: Enable debug mode during development
- Document Your Setup: Keep notes on your redirection configurations
- Design Clear Triggers: Make it obvious when players should see external links
- Consider Accessibility: Ensure redirections are accessible to all players
- Test Cross-Browser: Verify URLs work in different browsers
Security Considerations
- URL Validation: Only redirect to trusted, known URLs
- HTTPS Only: Use https:// protocol for all external links
- User Consent: Consider informing players before opening external links
- Testing: Always test URLs before deployment
- Documentation: Keep URLs documented for maintenance purposes