跳转至

setMotion

格式

setMotion(motion)

简介

设置角色运动,运动类型详见MOTION

注意

设置角色行走(WALK)动作,角色进行移动运动时会执行行走(WALK)动作。

参数

名称 类型 描述
motion key 运动类型

实例

当运行开始时角色mob向前移动。

import fg
import wx
import vmath

asset = fg.AssetCreate()
asset.name = 'Main Scene'
asset.state = fg.STATE.VOXMODEL
asset.vmFile = 'mainScene'
asset.icon='icon.png'

fg.AssetRegister(asset)

mob = fg.AssetCreate((fg.SimpleMob,))
mob.name = 'mob'
mob.state = fg.STATE.MOBILE
mob.mobSkeleton = 'skeleton.ozz'
mob.mobMesh = 'mesh.ozz'
mob.mobTexture = 'texture.png'
mob.mobAction = 'action.ozz'
mob.icon='mob.png'

def onStart(self):
    global mob
    mob=fg.AssetBuildEntity(fg.AssetRegister(mob), self.id, vmath.Vec3(0,25,0))
    mob.setMotion(wx.MOTION.FORWARD)

fg.AssetSetStartCBFunc(asset, onStart)