跳转至

MobAttachVM2Joint 体素模型绑定至角色关节

格式

MobAttachVM2Joint(mobId, vmId, jointId)

简介

将体素模型绑定在角色关节。

参数

名称 类型 描述
mobId int 角色ID
vmId int 体素模型ID
jointId int 角色关节ID

实例

按下鼠标左键时将体素模型A绑定在角色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()
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'

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

def onStart(self):
    global mob,A
    mob=fg.AssetBuildEntity(fg.AssetRegister(mob), self.id, vmath.Vec3(0, 25, 0))
    A=fg.AssetBuildEntity(fg.AssetRegister(A), self.id, vmath.Vec3(0, 25, 0))

def onmouse(self, stamp, button, action, mods):
    if button==wx.MOUSE_BUTTON.LEFT and action==wx.ACTION.PRESS:
        wx.MobAttachVM2Joint(mob.id,A.id,1)

fg.AssetSetStartCBFunc(asset, onStart)
fg.AssetSetMouseButtonCBFunc(asset, onmouse)