跳转至

setActionTime

格式

setActionTime(time)

简介

设置角色动作总时长为总帧数/30,如设置站立(STAND)动作,角色mob执行完不循环动作后回到站立(STAND)动作,不设置动作总时长时,角色会只执行站立(STAND)动作。

参数

名称 类型 描述
time float 时间

实例

当运行开始时设置角色mob动作文件的动作总时长为1秒。

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.setActionTime(1)
    mob.setAction("stand", 0.5, 1)
    mob.setAction("eat", 0, 0.5)
    mob.doAction("eat")

fg.AssetSetStartCBFunc(asset, onStart)