Gameplay / IntegratedMover
IntegratedMover Class
Motor components
Example usage: Create a script called "IMEample1", place it in the object bar, open the script, enter the following code to save, run the game, and you will see two rectangular prisms in the scene, repeating linear motion with and without smooth motion. The code is as follows:
@Component
export default class IMExample1 extends Script {
// Declare variables
Obj1;
Obj2;
IM1;
IM2;
// When the script is instantiated, this function will be called before the first frame update
protected async onStart(): Promise<void> {
if (SystemUtil.isClient()) {
// Create a box
this.Obj1 = await GameObject.asyncSpawn("197386") as GameObject;
// Set starting position
this.Obj1.worldTransform.position = new Vector(300.0, -100.0, 300.0);
// Set Start scale
this.Obj1.worldTransform.scale = new Vector(0.5, 2.0, 0.5);
// Create a Integrated Mover and mount the Integrated Mover onto the box
this.IM1 = await GameObject.asyncSpawn("PhysicsSports") as IntegratedMover;
this.IM1.attachToGameObject(this.Obj1);
// Test enabled status
console.log("Enable status: " + this.IM1.enable);
this.IM1.enable = true;
console.log("New enable status: " + this.IM1.enable);
// Add a linear motion
this.IM1.linearSpeed = new Vector(0.0, 100.0, 0.0);
this.IM1.linearRepeat = true;
this.IM1.linearRepeatTime = 2.0;
this.IM1.linearRepeatDelay = 0.0;
this.IM1.linearReturnDelay = 0.0;
// Create the second box and the second Integrated Mover in the same way
this.Obj2 = await GameObject.asyncSpawn("197386") as GameObject;
this.Obj2.worldTransform.position = new Vector(300.0, -100.0, 150.0);
this.Obj2.worldTransform.scale = new Vector(0.5, 2.0, 0.5);
this.IM2 = await GameObject.asyncSpawn("PhysicsSports") as IntegratedMover;
this.IM2.attachToGameObject(this.Obj2);
this.IM2.enable = true;
// Turn on smooth motion for the second Integrated Mover
console.log("Smooth status: " + this.IM2.smooth);
this.IM2.smooth = true;
console.log("New smooth status: " + this.IM2.smooth);
// Add an identical linear motion
this.IM2.linearSpeed = new Vector(0.0, 100.0, 0.0);
this.IM2.linearRepeat = true;
this.IM2.linearRepeatTime = 2.0;
this.IM2.linearRepeatDelay = 0.0;
this.IM2.linearReturnDelay = 0.0;
}
}
}
@Component
export default class IMExample1 extends Script {
// Declare variables
Obj1;
Obj2;
IM1;
IM2;
// When the script is instantiated, this function will be called before the first frame update
protected async onStart(): Promise<void> {
if (SystemUtil.isClient()) {
// Create a box
this.Obj1 = await GameObject.asyncSpawn("197386") as GameObject;
// Set starting position
this.Obj1.worldTransform.position = new Vector(300.0, -100.0, 300.0);
// Set Start scale
this.Obj1.worldTransform.scale = new Vector(0.5, 2.0, 0.5);
// Create a Integrated Mover and mount the Integrated Mover onto the box
this.IM1 = await GameObject.asyncSpawn("PhysicsSports") as IntegratedMover;
this.IM1.attachToGameObject(this.Obj1);
// Test enabled status
console.log("Enable status: " + this.IM1.enable);
this.IM1.enable = true;
console.log("New enable status: " + this.IM1.enable);
// Add a linear motion
this.IM1.linearSpeed = new Vector(0.0, 100.0, 0.0);
this.IM1.linearRepeat = true;
this.IM1.linearRepeatTime = 2.0;
this.IM1.linearRepeatDelay = 0.0;
this.IM1.linearReturnDelay = 0.0;
// Create the second box and the second Integrated Mover in the same way
this.Obj2 = await GameObject.asyncSpawn("197386") as GameObject;
this.Obj2.worldTransform.position = new Vector(300.0, -100.0, 150.0);
this.Obj2.worldTransform.scale = new Vector(0.5, 2.0, 0.5);
this.IM2 = await GameObject.asyncSpawn("PhysicsSports") as IntegratedMover;
this.IM2.attachToGameObject(this.Obj2);
this.IM2.enable = true;
// Turn on smooth motion for the second Integrated Mover
console.log("Smooth status: " + this.IM2.smooth);
this.IM2.smooth = true;
console.log("New smooth status: " + this.IM2.smooth);
// Add an identical linear motion
this.IM2.linearSpeed = new Vector(0.0, 100.0, 0.0);
this.IM2.linearRepeat = true;
this.IM2.linearRepeatTime = 2.0;
this.IM2.linearRepeatDelay = 0.0;
this.IM2.linearReturnDelay = 0.0;
}
}
}
Hierarchy
↳
IntegratedMover
Table of contents
Properties
onLinearEnable: MulticastDelegate <() => void > |
---|
The first time the translational motion is delayed to start, the callback event cannot be obtained because it is not enable when the delay start time is 0 |
onLinearReturn: MulticastDelegate <() => void > |
When the translational movement reaches the end point, it will be recalled. When the pause time after repeat delay is 0, it will not be enable, and callback events cannot be obtained |
onLinearStart: MulticastDelegate <() => void > |
When the translational motion returns to the starting point and pauses, it will callback. When the pause time is 0 after returning, it will not be enabled and cannot obtain callback events |
onRotationEnable: MulticastDelegate <() => void > |
The rotation movement is called back when it is delayed to start for the first time. When the delay start time is 0, it indicates that it is not enable, and the callback event cannot be obtained |
onRotationReturn: MulticastDelegate <() => void > |
When the rotational motion reaches the endpoint and pauses, it will callback. When the pause time is 0, it will not be enabled and cannot obtain callback events |
onRotationStart: MulticastDelegate <() => void > |
When the rotation motion returns to the starting point and pauses, it will callback. When the pause time is 0 after returning, it will not be enabled and cannot obtain callback events |
onScaleEnable: MulticastDelegate <() => void > |
When the scaling motion is delayed for the first time, it will callback. When the delay start time is 0, it will not be enabled and cannot obtain callback events |
onScaleReturn: MulticastDelegate <() => void > |
When the scale movement reaches the end point, it will be recalled. When the repeat delay is 0, it will not be enable, and callback events cannot be obtained |
onScaleStart: MulticastDelegate <() => void > |
When the scaling motion returns to the starting point and pauses, it will be called back. When the pause time is 0 after returning, it will not be enabled and cannot obtain callback events |
onSwingEnable: MulticastDelegate <() => void > |
Swing: Delayed start callback |
click
Properties
onBeforeDestroyDelegate: MulticastDelegate <() => void > other |
---|
Event callback before object destruction |
onCustomPropertyChange: Readonly <MulticastDelegate <(path : string , value : unknown , oldValue : unknown ) => void >> other |
Monitor custom attribute synchronization events |
onDestroyDelegate: MulticastDelegate <() => void > other |
Event callback after object destruction |
onPropertyChange: Readonly <MulticastDelegate <(path : string , value : unknown , oldValue : unknown ) => void >> |
Monitor system replicated events |
Accessors
enable(): boolean other |
---|
Get enabled status |
linearDelayStartTime(): number other |
Obtain the delay start translation running time |
linearRepeat(): boolean other |
Obtain the status of translational repetitive motion |
linearRepeatDelay(): number other |
Obtain the pause time after the translation arrives |
linearRepeatTime(): number other |
Obtain the translation repeat time |
linearReturnDelay(): number other |
Obtain the pause time after the translation return trip |
linearSpeed(): Vector other |
Obtain the magnitude of translation speed |
motionCoordinate(): MotionAxis other |
Obtain the motion coordinate system |
motionMode(): MotionMode other |
Get sports mode |
rotationDelayStartTime(): number other |
Obtain the delay start rotation running time |
rotationRepeat(): boolean other |
Obtain the rotational repetitive motion state |
rotationRepeatDelay(): number other |
Obtain the pause time after the rotation arrives |
rotationRepeatTime(): number other |
Obtain the one-way rotation motion time |
rotationReturnDelay(): number other |
Obtain the pause time after the rotation return delay |
rotationSpeed(): Vector other |
Obtain the rotational speed magnitude |
scaleDelayStartTime(): number other |
Get delayed startup scaling runtime |
scaleRepeat(): boolean other |
Get scale Repeat Motion Status |
scaleRepeatDelay(): number other |
Get the pause time after zooming in and out |
scaleRepeatTime(): number other |
Obtain the zoom one-way motion time |
scaleReturnDelay(): number other |
Obtain the pause time after scaling the return trip |
scaleSpeed(): Vector other |
Get scale speed |
smooth(): boolean other |
Obtain smooth state |
swingAngle(): number other |
Obtain the maximum swing angle |
swingDelayStartTime(): number other |
Obtain the delay start swing running time |
swingSpeed(): Vector other |
Obtain the speed of swinging motion |
click
Accessors
actorFlagValue(): number other |
---|
Get object tags |
actorLevel(): number other |
Obtain Actor Level |
assetId(): string other |
Retrieve the UID of the resource currently being used by the object |
gameObjectId(): string other |
Get the unique identification of an object (a string that uniquely identifies an object). |
isDestroyed(): boolean other |
Has the current object been destroyed |
isReady(): boolean other |
Current object status |
localTransform(): Transform other |
Local transformation of the current object |
name(): string other |
Return the current object name |
netStatus(): NetStatus other |
Get the current object synchronization status |
parent(): GameObject other |
Retrieve the current parent object |
tag(): string other |
Get the tag of the current object |
worldTransform(): Transform other |
Current object world transformation |
Methods
moverReset(OnReset? : () => void ): void other |
---|
Reset the state of the motion device and return the moving object to its initial position simultaneously |
click
Methods
addComponent<T : extends Script <T >>(constructor : (...args : unknown []) => T : extends Script <T >, bInReplicates? : boolean ): T : extends Script <T > other |
---|
Add a script component |
asyncGetChildByName(name : string ): Promise <GameObject > other |
Asynchronous search for sub objects based on their names |
asyncReady(): Promise <GameObject > other |
Return after the object is ready |
clone(gameObjectInfo? : GameObjectInfo ): GameObject other |
Copy Objects |
destroy(): void other |
delete object |
getBoundingBox(nonColliding? : boolean , includeFromChild? : boolean , outer? : Vector ): Vector other |
Get the size of the object's bounding box |
getBounds(onlyCollidingComponents : boolean , originOuter : Vector , boxExtentOuter : Vector , includeFromChild? : boolean ): void other |
Obtain object boundaries |
getChildByGameObjectId(gameObjectId : string ): GameObject other |
Search for sub objects based on gameObjectid |
getChildByName(name : string ): GameObject other |
Search for sub objects by name |
getChildByPath(path : string ): GameObject other |
Find sub objects according to path |
getChildren(): GameObject [] other |
Obtain sub objects |
getChildrenBoundingBoxCenter(outer? : Vector ): Vector other |
Get the center point of all child objects' bounding box (not including the parent object, if the parent object is unavailable, return [0,0,0]) |
getChildrenByName(name : string ): GameObject [] other |
Search for all sub objects by name |
getComponent<T : extends Script <T >>(constructor? : (...args : unknown []) => T : extends Script <T >): T : extends Script <T > other |
Get the component of the specified type |
getComponentPropertys<T : extends Script <T >>(constructor : (...args : unknown []) => T : extends Script <T >): Map <string , IPropertyOptions > other |
Get property of script component |
getComponents<T : extends Script <T >>(constructor? : (...args : unknown []) => T : extends Script <T >): T : extends Script <T >[] other |
Get all component of the specified type |
getCustomProperties(): string [] other |
Get all customize property |
getCustomProperty<T : extends CustomPropertyType >(propertyName : string ): T : extends CustomPropertyType other |
Get customize property |
getCustomPropertyChangeDelegate(property ): Readonly <MulticastDelegate <(path : string , value : unknown , oldValue : unknown ) => void >> other |
Event proxy triggered when a given object property is modified |
getPropertyChangeDelegate(property ): Readonly <MulticastDelegate <(path : string , value : unknown , oldValue : unknown ) => void >> other |
Event proxy triggered when a given object property is modified |
getVisibility(): boolean other |
Obtain whether the object is displayed |
isPrefabActor(): boolean other |
Return whether the current object is a prefabricated body |
moveBy(velocity : Vector , isLocal? : boolean ): void other |
Smoothly move an object over time according to a given velocity vector |
moveTo(targetPosition : Vector , time : number , isLocal? : boolean , onComplete? : () => void ): void other |
Smoothly move from the current position to the target position within the specified time |
rotateBy(rotation : Quaternion Rotation , multiplier : number , isLocal? : boolean ): void other |
Rotate the object smoothly over time according to the given rotation amount |
rotateTo(targetRotation : Quaternion Rotation , time : number , isLocal? : boolean , onComplete? : () => void ): void other |
Smoothly changes from the current rotation to the target rotation within the specified time |
scaleBy(scale : Vector , isLocal? : boolean ): void other |
Smoothly scale objects over time using a given scaling vector per second |
scaleTo(targetScale : Vector , time : number , isLocal? : boolean , onComplete? : () => void ): void other |
Smoothly changes from the current scale to the target scale within the specified time |
setAbsolute(absolutePosition? : boolean , absoluteRotation? : boolean , absoluteScale? : boolean ): void other |
Set whether the object localTransform is relative to the parent object or the world |
setCustomProperty(propertyName : string , value : undefined CustomPropertyType ): void other |
Set custom attributes |
setVisibility(status : boolean PropertyStatus , propagateToChildren? : boolean ): void other |
Set whether the object is displayed |
stopMove(): void other |
Interrupt further movement of moveTo() and moveBy() |
stopRotate(): void other |
Interrupt further rotation from rotateTo() or rotateBy() |
stopScale(): void other |
Interrupt further scale from ScaleTo() or ScaleBy() |
asyncFindGameObjectById(gameObjectId : string ): Promise <GameObject > other |
Asynchronous search for GameObject through gameObjectid |
asyncGetGameObjectByPath(path : string ): Promise <GameObject > other |
Asynchronously find objects through path |
asyncSpawn<T : extends GameObject <T >>(assetId : string , gameObjectInfo? : GameObjectInfo ): Promise <T : extends GameObject <T >> other |
Asynchronous construction of an object |
bulkPivotTo(gameObjects : GameObject [], transforms : Transform []): void other |
Batch set position |
findGameObjectById(gameObjectId : string ): GameObject other |
Search for objects through gameObjectid |
findGameObjectByName(name : string ): GameObject other |
Search for objects by name |
findGameObjectsByName(name : string ): GameObject [] other |
Search for objects by name |
findGameObjectsByTag(tag : string ): GameObject [] other |
Get objects through customize tag |
getGameObjectByPath(path : string ): GameObject other |
Search for objects through paths |
spawn<T : extends GameObject <T >>(assetId : string , gameObjectInfo? : GameObjectInfo ): T : extends GameObject <T > other |
Construct an object |
Properties
onLinearEnable
• onLinearEnable: MulticastDelegate
<() => void
>
The first time the translational motion is delayed to start, the callback event cannot be obtained because it is not enable when the delay start time is 0
onLinearReturn
• onLinearReturn: MulticastDelegate
<() => void
>
When the translational movement reaches the end point, it will be recalled. When the pause time after repeat delay is 0, it will not be enable, and callback events cannot be obtained
onLinearStart
• onLinearStart: MulticastDelegate
<() => void
>
When the translational motion returns to the starting point and pauses, it will callback. When the pause time is 0 after returning, it will not be enabled and cannot obtain callback events
onRotationEnable
• onRotationEnable: MulticastDelegate
<() => void
>
The rotation movement is called back when it is delayed to start for the first time. When the delay start time is 0, it indicates that it is not enable, and the callback event cannot be obtained
onRotationReturn
• onRotationReturn: MulticastDelegate
<() => void
>
When the rotational motion reaches the endpoint and pauses, it will callback. When the pause time is 0, it will not be enabled and cannot obtain callback events
onRotationStart
• onRotationStart: MulticastDelegate
<() => void
>
When the rotation motion returns to the starting point and pauses, it will callback. When the pause time is 0 after returning, it will not be enabled and cannot obtain callback events
onScaleEnable
• onScaleEnable: MulticastDelegate
<() => void
>
When the scaling motion is delayed for the first time, it will callback. When the delay start time is 0, it will not be enabled and cannot obtain callback events
onScaleReturn
• onScaleReturn: MulticastDelegate
<() => void
>
When the scale movement reaches the end point, it will be recalled. When the repeat delay is 0, it will not be enable, and callback events cannot be obtained
onScaleStart
• onScaleStart: MulticastDelegate
<() => void
>
When the scaling motion returns to the starting point and pauses, it will be called back. When the pause time is 0 after returning, it will not be enabled and cannot obtain callback events
onSwingEnable
• onSwingEnable: MulticastDelegate
<() => void
>
Swing: Delayed start callback
Accessors
enable
• | • | ||||
---|---|---|---|---|---|
Get enabled status Returns
| Set Enable Status Parameters
|
linearDelayStartTime
• | • | ||||
---|---|---|---|---|---|
Obtain the delay start translation running time Returns
| Set the delay to start the translational motion time Parameters
|
linearRepeat
• | • | ||||
---|---|---|---|---|---|
Obtain the status of translational repetitive motion Returns
| Set translational repetitive motion state Parameters
|
linearRepeatDelay
• | • | ||||
---|---|---|---|---|---|
Obtain the pause time after the translation arrives Returns
| Set the repeat delay after arrival of the translation. This property will take effect only when the repetitive motion status is true Parameters
|
linearRepeatTime
• | • | ||||
---|---|---|---|---|---|
Obtain the translation repeat time Returns
| Set the translation repeat time. This property will take effect only when the repeated motion status is true Parameters
|
linearReturnDelay
• | • | ||||
---|---|---|---|---|---|
Obtain the pause time after the translation return trip Returns
| Set the pause time after the translation return delay. This property will take effect only when the repetitive movement status is true Parameters
Pause time after translation return delay |
linearSpeed
• | • | ||||
---|---|---|---|---|---|
Obtain the magnitude of translation speed Usage example: create a script named "IMExample2", place it in the object bar, open the script, enter the following code to save it, run the game, and you will see two boxes in the scene, demonstrating whether there is a non repeated linear motion that is delayed to start, and whether there is a repeated linear motion that is stopped at the start and end. The code is as follows: ts
Returns
| Set the translation speed size Parameters
|
motionCoordinate
• | • | ||||
---|---|---|---|---|---|
Obtain the motion coordinate system Returns
| Set motion coordinate system Parameters
|
motionMode
• | • | ||||
---|---|---|---|---|---|
Get sports mode Returns
| Set sports mode Parameters
|
rotationDelayStartTime
• | • | ||||
---|---|---|---|---|---|
Obtain the delay start rotation running time Returns
| Set delay start rotation motion time Parameters
|
rotationRepeat
• | • | ||||
---|---|---|---|---|---|
Obtain the rotational repetitive motion state Returns
| Set the rotational repetitive motion state Parameters
|
rotationRepeatDelay
• | • | ||||
---|---|---|---|---|---|
Obtain the pause time after the rotation arrives Returns
| Set repeat delay after arrival of rotation This attribute will only take effect when the repeated motion state is true Parameters
|
rotationRepeatTime
• | • | ||||
---|---|---|---|---|---|
Obtain the one-way rotation motion time Returns
| Set the rotation repeat time This property takes effect only when the repeated motion state is true. Parameters
|
rotationReturnDelay
• | • | ||||
---|---|---|---|---|---|
Obtain the pause time after the rotation return delay Returns
| Set the pause time after the rotation return delay. This property will take effect only when the repeated movement status is true Parameters
|
rotationSpeed
• | • | ||||
---|---|---|---|---|---|
Obtain the rotational speed magnitude Usage example: create a script named "IMExample3", place it in the object bar, open the script, enter the following code to save it, run the game, and you will see two boxes in the scene, demonstrating whether there is non repeated rotation that is delayed to start, and whether there is repeated rotation that is stopped at the start and end. The code is as follows: ts
Returns
| Set the rotation speed size Parameters
|
scaleDelayStartTime
• | • | ||||
---|---|---|---|---|---|
Get delayed startup scaling runtime Returns
| Set delay to start scaling motion time Parameters
|
scaleRepeat
• | • | ||||
---|---|---|---|---|---|
Get scale Repeat Motion Status Returns
| Set zoom repeat motion state Parameters
|
scaleRepeatDelay
• | • | ||||
---|---|---|---|---|---|
Get the pause time after zooming in and out Returns
| Set the scale repeat delay after arrival. This property will take effect only when the repeated motion state is true Parameters
|
scaleRepeatTime
• | • | ||||
---|---|---|---|---|---|
Obtain the zoom one-way motion time Returns
| Set the scale repeat time. This property will take effect only when the repeated motion state is true Parameters
|
scaleReturnDelay
• | • | ||||
---|---|---|---|---|---|
Obtain the pause time after scaling the return trip Returns
| Set the pause time after scaling the return trip. This attribute will only take effect when the motion state is set to true repeatedly Parameters
|
scaleSpeed
• | • | ||||
---|---|---|---|---|---|
Get scale speed Usage example: create a script named "IMExample4", place it in the object bar, open the script, enter the following code to save it, run the game, and you will see two cubes in the scene, demonstrating whether there is non repeated scale that starts late, and whether there is repeated scale that stops at the start and end. The code is as follows: ts
Returns
| Set the zoom speed size Parameters
|
smooth
• | • | ||||
---|---|---|---|---|---|
Obtain smooth state Returns
| Set the smooth state, and when enabled, the motion speed will gradually increase from slow to maximum Parameters
|
swingAngle
• | • | ||||
---|---|---|---|---|---|
Obtain the maximum swing angle Returns
| Set the maximum swing angle Parameters
|
swingDelayStartTime
• | • | ||||
---|---|---|---|---|---|
Obtain the delay start swing running time Returns
| Set delay start swing motion time Parameters
|
swingSpeed
• | • | ||||
---|---|---|---|---|---|
Obtain the speed of swinging motion Usage example: create a script named "IMExample5", place it in the object bar, open the script, enter the following code to save it, run the game, and you will see two boxes in the scene to demonstrate whether there is a delay in starting the pendulum motion. The code is as follows: ts
Returns
| Set the swing motion speed Parameters
|
Methods
moverReset
• moverReset(OnReset?
): void
other
Reset the state of the motion device and return the moving object to its initial position simultaneously
Parameters
OnReset? () => void | Usage: Execute callback default: null |
---|