0.22.0 • Published 19 days ago

@superviz/threejs-plugin v0.22.0

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
19 days ago

SuperViz threejs SDK plugin

Description

@superviz/threejs-plugin is a plug and play package that you can use together with the superviz sdk to easily inject custom avatars and functionality to your threejs 3d world.

  • current threejs version supported: TODO

Getting started

import SuperViz, {
	MeetingEvent
} from '@superviz/sdk';

import { threejsPlugin } from '@superviz/threejs-plugin';

const supervizSdk = await SuperViz.init(DEVELOPER_KEY, { // for more info on the superviz sdk check docs.superviz.com
	userGroup: {
			id: "<GROUP-ID>",
			name: "<GROUP-NAME>"
	},
	user: {
			id: "<MY-USER-ID>",
			name: "<MY-USER-NAME>",
			isHostCandidate: true,
			avatar: {
				model: "YOUR_AVATAR_URL.gltf"
			}
	},
	roomId: "<ROOM-ID>",
	debug: true
});

const plugin = new threejsPlugin(scene, camera, player);
//player.userData.avatar // TODO EXPLICAR

supervizSdk.subscribe(MeetingEvent.MY_USER_JOINED, () => {
	this.threejsPluginInstance = supervizSdk.connectPlugin(plugin, {

		avatarConfig: {
			height: 0,
			scale: 1,
		},
		isAvatarsEnabled: true,
		isPointersEnabled: true,
		isNameEnabled: true,
		renderLocalAvatar: true,
	});
});

SDK user initialization parameters

  • avatar.model: the URL of the .gltf or .glb model you want to be the avatar of the current user instance. The plugin will use this URL to create the avatar.

Plugin initialization options

  • avatarConfig.scale: the scale you want your avatar to be rendered
  • avatarConfig.height: the height you want your avatar to be positioned
  • isAvatarsEnabled: enable or disable avatar creation
  • isPointersEnabled: enable or disable pointer creation (if avatars are disabled, isPointersEnabled is forced to false)

SDK Methods

  • getUsersOn3D()

    To access users current 3D properties like position, rotation use: this.threejsPluginInstance.getUsersOn3D();

  • e.g

    [{
    	id: 123,
    	name: "John Doe",
    	avatar: {
    		model: "model.gltf"
    	},
    	avatarConfig: {
    		scale: 1,
    		height: 0
    	},
    	position: { x: 0, y: 0, z: 0 },
    	rotation: { x: 0, y: 0 }
    }]
  • getAvatars()

    To access users avatar class instances: this.threejsPluginInstance.getAvatars();

  • e.g const avatars = this.threejsPluginInstance.getAvatars() avatarsuserId.model // Object3D Instance avatarsuserId.animations // Animations List

Considerations

Before changing your threejs model you have to call this.supervizSdk.disconnectPlugin() and then after the new threejs model is loaded you have to connect the plugin again.

Further functionality, like follow mode, is expected to be released soon.

Issues

To report a new bug or request a new feature, please contact us at contact@superviz.com

Superviz threejs-plugin is BSD 2 licensed.

0.20.0-lab.8

19 days ago

0.20.0-beta.5

27 days ago

0.22.0

27 days ago

0.20.0-lab.7

2 months ago

0.21.0

2 months ago

0.20.0-lab.6

2 months ago

0.20.0-beta.4

2 months ago

0.20.0-lab.5

2 months ago

0.20.0-beta.3

2 months ago

0.20.3

2 months ago

0.20.0-lab.4

2 months ago

0.20.0-lab.3

3 months ago

0.20.0-beta.2

3 months ago

0.20.2

3 months ago

0.20.1

3 months ago

0.20.0-lab.2

3 months ago

0.20.0-beta.1

3 months ago

0.20.0-lab.1

3 months ago

0.20.0

3 months ago

0.19.1

4 months ago

0.19.0

4 months ago

0.18.0

4 months ago

0.17.0

5 months ago

0.16.0

5 months ago

0.15.0

5 months ago

0.14.0

6 months ago

0.12.0

12 months ago

0.13.0

12 months ago

0.11.2

1 year ago

0.13.1

12 months ago

0.11.3

1 year ago

0.13.2

12 months ago

0.11.4

1 year ago

0.13.3

12 months ago

0.11.5

12 months ago

0.13.4

12 months ago

0.13.5

12 months ago

0.11.1

1 year ago

0.9.3

1 year ago

0.11.0

1 year ago

0.10.0

1 year ago

0.9.0

1 year ago

0.7.2

1 year ago

0.5.4

1 year ago

0.8.0

1 year ago

0.7.1

1 year ago

0.5.3

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.5.5

1 year ago

0.5.0

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.7.0

1 year ago

0.6.1

1 year ago

0.5.2

1 year ago

0.6.0

1 year ago

0.5.1

1 year ago

0.4.2

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago