npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

myroom-react

v1.0.0

Published

React component wrapper for MyRoom 3D scene

Readme

MyRoom React Component

A React component wrapper for the MyRoom 3D scene system, providing an easy-to-use interface for integrating 3D avatar and room management into React applications.

Features

  • 🎮 3D Scene Management: Full Babylon.js 3D scene with avatar and room support
  • 👤 Avatar System: Customizable avatars with gender, parts, and colors
  • 🏠 Room Management: Load and manage 3D rooms and furniture items
  • 🎯 Interactive Controls: Camera controls, item selection, and manipulation
  • 📱 Responsive Design: Works on desktop and mobile devices
  • 🔧 TypeScript Support: Full TypeScript definitions included

Installation

npm install myroom-react

Quick Start

import React from 'react';
import { MyRoomScene } from 'myroom-react';

function App() {
  return (
    <MyRoomScene
      roomPath="/models/rooms/cate001/MR_KHROOM_0001.glb"
      gender="male"
      width="100%"
      height="600px"
      onSceneReady={(scene) => console.log('Scene ready:', scene)}
    />
  );
}

Props

Basic Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | roomPath | string | "/models/rooms/cate001/MR_KHROOM_0001.glb" | Path to the 3D room model | | gender | 'male' \| 'female' | 'female' | Avatar gender | | width | string | '800px' | Component width | | height | string | '600px' | Component height | | autoplay | boolean | false | Auto-start animations |

Avatar Configuration

| Prop | Type | Default | Description | |------|------|---------|-------------| | avatarConfig | AvatarConfig | Auto-generated | Complete avatar configuration | | enableControls | boolean | true | Enable UI controls | | cameraControls | boolean | true | Enable camera controls |

Items Management

| Prop | Type | Default | Description | |------|------|---------|-------------| | loadedItems | LoadedItem[] | [] | Array of items to load in the scene | | gizmoMode | 'position' \| 'rotation' \| 'scale' | 'position' | Current gizmo mode for item manipulation |

Event Handlers

| Prop | Type | Description | |------|------|-------------| | onSceneReady | (scene: Scene, engine: Engine) => void | Called when the 3D scene is ready | | onAvatarChanged | (config: AvatarConfig) => void | Called when avatar configuration changes | | onItemSelected | (item: any) => void | Called when an item is selected | | onCameraMoved | (position: any, target: any) => void | Called when camera moves | | onError | (error: any) => void | Called when an error occurs |

Advanced Usage

Custom Avatar Configuration

import { AvatarConfig } from 'myroom-react';

const customAvatarConfig: AvatarConfig = {
  gender: 'female',
  parts: {
    body: '/models/female/female_body/female_body.glb',
    hair: '/models/female/female_hair/female_hair_001.glb',
    top: '/models/female/female_top/female_top_001.glb',
    bottom: '/models/female/female_bottom/female_bottom_001.glb',
    shoes: '/models/female/female_shoes/female_shoes_001.glb'
  },
  colors: {
    hair: '#8B4513',
    top: '#FF6B6B',
    bottom: '#4ECDC4',
    shoes: '#45B7D1'
  }
};

<MyRoomScene
  avatarConfig={customAvatarConfig}
  roomPath="/models/rooms/cate001/MR_KHROOM_0001.glb"
/>

Loading Items

import { LoadedItem } from 'myroom-react';

const items: LoadedItem[] = [
  {
    id: 'chair-1',
    name: 'Comfortable Chair',
    path: '/models/items/catelv1_01/catelv2_01/catelv3_01/MR_CHAIR_0001.glb',
    position: { x: 0, y: 0, z: 2 },
    rotation: { x: 0, y: Math.PI / 4, z: 0 },
    scale: { x: 1, y: 1, z: 1 }
  }
];

<MyRoomScene
  loadedItems={items}
  onItemSelected={(item) => console.log('Selected:', item)}
/>

Using the Component Ref

import React, { useRef } from 'react';
import { MyRoomScene, MyRoomSceneRef } from 'myroom-react';

function App() {
  const sceneRef = useRef<MyRoomSceneRef>(null);

  const handleResetCamera = () => {
    sceneRef.current?.resetCamera();
  };

  const handleChangeAvatar = async (config: AvatarConfig) => {
    await sceneRef.current?.changeAvatar(config);
  };

  return (
    <div>
      <button onClick={handleResetCamera}>Reset Camera</button>
      <MyRoomScene
        ref={sceneRef}
        roomPath="/models/rooms/cate001/MR_KHROOM_0001.glb"
        onSceneReady={(scene) => console.log('Scene ready')}
      />
    </div>
  );
}

Available Rooms

  • Living Room: /models/rooms/cate001/MR_KHROOM_0001.glb
  • Exercise Room: /models/rooms/cate001/MR_KHROOM_0002.glb
  • Lounge Room: /models/rooms/cate002/MR_KHROOM_0003.glb

Available Items

  • Chair: /models/items/catelv1_01/catelv2_01/catelv3_01/MR_CHAIR_0001.glb
  • Light Stand: /models/items/catelv1_01/catelv2_01/catelv3_02/MR_LIGHTSTAND_0002.glb
  • Board: /models/items/catelv1_02/catelv2_02/catelv3_02/MR_KH_BOARD_0001.glb
  • Mirror: /models/items/catelv1_02/catelv2_03/catelv3_02/MR_MIRROR_0001.glb

Styling

The component uses CSS modules for styling. You can customize the appearance by overriding CSS classes:

.myroom-scene {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.myroom-scene canvas {
  border-radius: 8px;
}

Browser Support

  • Chrome 80+
  • Firefox 75+
  • Safari 13+
  • Edge 80+

License

MIT License - see LICENSE file for details.