MovePlugin
Overview
MovePlugin provides the ability to automatically preview a walkthrough along a given path while in model mode.
External Demo
Open the MovePlugin demo. In the external demo, choose Play to start the walkthrough preview.
Installation
import { MovePlugin } from "@realsee/dnalogel"Development Guide
Plugin Initialization Parameters
interface MovePluginConfig {
/**
* @description: Camera offset relative to the path during the walkthrough
* @default: { x: 0, y: 2, z: 0 }
*/
offset?: { x?: number; y?: number; z?: number }
/**
* @description: Allow the walkthrough to be interrupted by swiping the screen
* @default: true
*/
allowBroke?: boolean
/**
* @description: Whether to load the route during the walkthrough
*/
useGuideLine?: boolean
}
const movePluginConfig: MovePluginConfig = {}Initialization
When initializing the Five instance, simply add MovePlugin to the initialization plugin parameters.
Initialization plugin parameters:
import { Five } from '@realsee/five'
import { MovePlugin } from "@realsee/dnalogel";
const five = new Five({
plugins: [
[
MovePlugin,
'movePlugin', // Custom plugin name
movePluginConfig
]
]
})Loading Data
You must load path walkthrough data in order to see the correct result:
// Load path data
five.plugins.movePlugin.load({
// Spatial coordinate points that make up the path
path: [
[0.09141919761896133, 0.008460694152031545, -0.08654399961233139],
[-1.6820100545883179, 0.01284792484609465, 0.07329510152339935],
[-3.437459945678711, 0.01757188648782715, 0.06699030101299286],
[-0.618914008140564, 0.008730999445763388, -1.6621500253677368],
],
/**
* Optional
* @description: Walkthrough camera offset. Note that it is added on top of the config.offset specified during plugin initialization.
* @default: { x: 0, y: 0, z: 0 }
*/
offset: { y: 0 },
/**
* Optional
* @description: Whether to load the route during the walkthrough
*/
useGuideLine: true
})// Start the walkthrough
five.plugins.movePlugin.play();
// Pause the walkthrough
five.plugins.movePlugin.pause();Core Methods
load(serverData: PluginServerData | PluginServerData['data'])Load plugin dataplay: () => voidStart the walkthroughpause: () => voidPause the walkthroughsetState: (state: Partial<PluginState>) => voidSet walkthrough parametersshow: () => voidShow the walkthrough pathhide: () => voidHide the walkthrough pathenable: () => voidEnable the plugindisable: () => voidDisable the plugindispose: () => voidDestroy the plugin
