本帖最后由 今晚月亮缺席 于 2023-10-31 14:28 编辑
代码如下
public async attachScooter(player: mw.Player) {
const character = player.character;
/**装滑板 */
const scooter = await mw.GameObject.asyncSpawn("87017")
character.attachToSlot(scooter, mw.HumanoidSlotType.Root);
scooter.localTransform.position = new mw.Vector(0, 0, 2);
scooter.localTransform.scale = new mw.Vector(1, 1, 0.6);
scooter.setCollision(mw.PropertyStatus.Off);
/**拖尾特效 */
EffectService.playOnGameObject("151527", character, { slotType: mw.HumanoidSlotType.Root, loopCount: 0, position: new mw.Vector(-80, 0, 0) })
/**角色动作 */
await AssetUtil.asyncDownloadAsset("151060")
const stance = character.loadSubStance("151060");
stance.blendMode = mw.StanceBlendMode.WholeBody;
stance.play()
/**角色速度 */
character.maxWalkSpeed = 450 * 3
}
用character.loadSubStance()而不是character.loadStance()接口是因为loadStance可以设置混合模式而不影响角色播放其他动作
效果视频
|