Particle
粒子特效
对粒子特效进行控制处理函数列表
PlayOnCharacter
-
描述: 在角色上创建特效
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectType | number | 特效类型 |
| PlayerID | number | 玩家id |
| SocketName | Character.SOCKET_NAME | 骨骼节点 |
| IsAutoDestroy | boolean | 是否过一段时间自动销毁,默认为false |
| StopTime | number | 自动销毁需要等待的时间,默认为0 |
返回字段:
| 返回字段 | 字段类型 | 说明 |
|---|---|---|
| effectId | number | 当前创建的特效ID,小于0表示创建失败 |
local effectType = 57local effectId = Particle:PlayOnCharacter(effectType, playerId, Character.SOCKET_NAME.Root, true, 10)PlayOnActor
-
描述: 在元件上创建特效
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectType | number | 特效类型 |
| ElementId | number | 元件id |
| IsAutoDestroy | boolean | 是否过一段时间自动销毁,默认为false |
| StopTime | number | 自动销毁需要等待的时间,默认为0 |
返回字段:
| 返回字段 | 字段类型 | 说明 |
|---|---|---|
| effectId | number | 当前创建的特效ID,小于0表示创建失败 |
local effectType = 57local elementId = 521local effectId = Particle:PlayOnActor(effectType, elementId, true, 100)PlayAtPosition
-
描述: 在场景中创建特效
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectType | number | 特效类型 |
| Pos | Engine.Vector | 创建特效在场景中的位置坐标 |
| Scale | number | 创建特效的缩放 |
| IsAutoDestroy | boolean | 是否过一段时间自动销毁,默认为false |
| StopTime | number | 自动销毁需要等待的时间,默认为0 |
返回字段:
| 返回字段 | 字段类型 | 说明 |
|---|---|---|
| effectId | number | 当前创建的特效ID,小于0表示创建失败 |
local effectType = 57local effectId = Particle:PlayAtPosition(effectType, Engine.Vector(100,100,0), 1, true, 100)PlayOnCreature
-
描述: 在生物上创建特效
-
范围: 客户端
-
警告: 四足生物不支持
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectType | number | 特效类型 |
| CreatureId | number | 生物id |
| SocketName | Character.SOCKET_NAME | 骨骼节点 |
| IsAutoDestroy | boolean | 是否过一段时间自动销毁,默认为false |
| StopTime | number | 自动销毁需要等待的时间,默认为0 |
返回字段:
| 返回字段 | 字段类型 | 说明 |
|---|---|---|
| effectId | number | 当前创建的特效ID,小于0表示创建失败 |
local effectType = 57local creatureId = 521local effectId = Particle:PlayOnCreature(effectType, creatureId, Character.SOCKET_NAME.Head, true, 100)PlayOnCamera
-
描述: 在相机上创建特效
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectType | number | 特效类型 |
| IsAutoDestroy | boolean | 是否过一段时间自动销毁,默认为false |
| StopTime | number | 自动销毁需要等待的时间,默认为0 |
返回字段:
| 返回字段 | 字段类型 | 说明 |
|---|---|---|
| effectId | number | 当前创建的特效ID,小于0表示创建失败 |
local effectType = 57local effectId = Particle:PlayOnCamera(effectType, true, 100)StopParticle
-
描述: 销毁特效
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectId | number | 创建特效时返回的ID |
local effectType = 57local sceneid = 521local effectId = Particle:PlayOnCreature(effectType, sceneid, Character.SOCKET_NAME.Head, true, 100)Particle:StopParticle(effectId)SetParticlePosition
-
描述: 设置特效位置
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectId | number | 创建特效时返回的ID |
| Pos | Engine.Vector | 位置坐标。若在场景中时,设置坐标为世界坐标。若特效挂载在角色、元件等对象上,设置的坐标为局部坐标。 |
local effectType = 57local creatureId = 521local effectId = Particle:PlayOnCreature(effectType, creatureId, Character.SOCKET_NAME.Head, true, 100)Particle:SetParticlePosition(effectId, Engine.Vector(0, 0, 100))SetParticleRotation
-
描述: 设置特效旋转方向
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectId | number | 创建特效时返回的ID |
| Rot | Engine.Rotator | 旋转方向。若在场景中时,设置坐标为世界旋转。若特效挂载在角色、元件等对象上,设置的坐标为局部旋转。 |
local effectType = 57local creatureId = 521local effectId = Particle:PlayOnCreature(effectType, creatureId, Character.SOCKET_NAME.Head, true, 100)Particle:SetParticleRotation(effectId, Engine.Rotator(0, 90, 0))SetParticleScale
-
描述: 设置特效缩放倍数
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectId | number | 创建特效时返回的ID |
| Scale | Engine.Vector | 缩放倍数 |
local effectType = 57local creatureId = 521local effectId = Particle:PlayOnCreature(effectType, creatureId, Character.SOCKET_NAME.Head, true, 100)Particle:SetParticleScale(effectId, Engine.Vector(2, 2, 2))SetParticleColor
-
描述: 设置特效颜色
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectId | number | 创建特效时返回的ID |
| Area | number | 区域id |
| Color | string | 颜色,十六进制代码:#FFFFFFFF |
local effectType = 57local creatureId = 521local effectId = Particle:PlayOnCreature(effectType, creatureId, Character.SOCKET_NAME.Head, true, 100)Particle:SetParticleColor(effectId, 1, "#FFFFFFFF")SetParticleVisible
-
描述: 设置特效可见性
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectId | number | 创建特效时返回的ID |
| Visible | boolean | 是否可见 |
local effectType = 57local creatureId = 521local effectId = Particle:PlayOnCreature(effectType, creatureId, Character.SOCKET_NAME.Head, true, 100)Particle:SetParticleVisible(effectId, false)CreateChainParticle
-
描述: 创建两点之间的链式特效
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectType | number | 链式特效类型 |
| StartPos | Engine.Vector | 链式特效起始位置坐标 |
| EndPos | Engine.Vector | 链式特效结束位置坐标 |
| IsAutoDestroy | boolean | 是否过一段时间自动销毁,默认为false |
| StopTime | number | 自动销毁需要等待的时间,默认为0 |
返回字段:
| 返回字段 | 字段类型 | 说明 |
|---|---|---|
| effectId | number | 返回特效id |
local localPlayerId = Character:GetLocalPlayerId()local startPos = Character:GetPosition(localPlayerId)local endPos = Engine.Vector(0, 0, 500)local effectId = Particle:CreateChainParticle(228, startPos, endPos)UpdateChainParticle
-
描述: 刷新链式特效的起始和结束坐标点
-
范围: 客户端
参数列表:
| 参数 | 类型 | 说明 |
|---|---|---|
| EffectId | number | 创建链式特效时返回的id |
| StartPos | Engine.Vector | 链式特效起始位置坐标 |
| EndPos | Engine.Vector | 链式特效结束位置坐标 |
local localPlayerId = Character:GetLocalPlayerId()local startPos = Character:GetPosition(localPlayerId)local endPos = Engine.Vector(0, 0, 500)local effectId = Particle:CreateChainParticle(startPos, endPos)TimerManager:AddLoopFrame(1, function() startPos = Character:GetPosition(localPlayerId) Particle:UpdateChainParticle(effectId, startPos, endPos)end)