Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail
would be interested in any updated information you can provide!
Universal Fighting Engine Forum Universal Fighting Engine (UFE), a fighting game toolkit for Unity 3D |
You are not logged in. Please login or register.
Universal Fighting Engine Forum → Tips & Articles → (Source) Advanced Tutorial: Hit trails using XWeaponTrail
would be interested in any updated information you can provide!
I should have something ready to share over the weekend
cool!
Apologies for the lateness. Here's the changes to get it working.
In controlsScript, here's the new loop -
// Check Particle Effects
foreach (MoveParticleEffect particleEffect in move.particleEffects)
{
if (
!particleEffect.casted &&
particleEffect.particleEffect.prefab != null &&
move.currentFrame >= particleEffect.castingFrame
)
{
particleEffect.casted = true;
Vector3 newPosition = myHitBoxesScript.GetPosition(particleEffect.particleEffect.bodyPart);
GameObject pTemp;
if (particleEffect.particleEffect.isWeaponTrail)
{
pTemp = (GameObject)Instantiate(particleEffect.particleEffect.prefab,
newPosition,
Quaternion.identity);
Vector3 endPosition = myHitBoxesScript.GetPosition(particleEffect.particleEffect.bodyPartEnd);
pTemp.transform.parent = myHitBoxesScript.GetTransform(particleEffect.particleEffect.bodyPart);
XftWeapon.XWeaponTrail xComp = pTemp.GetComponent<XftWeapon.XWeaponTrail>();
xComp.PointStart.position = newPosition;
xComp.PointEnd.position = endPosition;
}
else
{
newPosition.x += particleEffect.particleEffect.positionOffSet.x * -mirror;
newPosition.y += particleEffect.particleEffect.positionOffSet.y;
newPosition.z += particleEffect.particleEffect.positionOffSet.z;
pTemp = (GameObject)Instantiate(particleEffect.particleEffect.prefab,
newPosition,
Quaternion.identity);
if (particleEffect.particleEffect.stick) pTemp.transform.parent = myHitBoxesScript.GetTransform(particleEffect.particleEffect.bodyPart);
}
StopParticleDelay spComp = pTemp.GetComponent<StopParticleDelay>();
if (spComp != null)
{
spComp.stopDelay = particleEffect.particleEffect.duration;
}
else
{
Destroy(pTemp, particleEffect.particleEffect.duration);
}
}
}
In XWeaponTrail.cs - replace the Deactivate() method with this one -
public void Deactivate()
{
gameObject.SetActive(false);
if (mMeshObj != null)
{
mMeshObj.SetActive(false);
mVertexPool.SetMeshObjectActive(false);
Destroy(mMeshObj);
}
Destroy(gameObject);
}
Apologies for the lateness. Here's the changes to get it working.
In controlsScript, here's the new loop -
// Check Particle Effects foreach (MoveParticleEffect particleEffect in move.particleEffects) { if ( !particleEffect.casted && particleEffect.particleEffect.prefab != null && move.currentFrame >= particleEffect.castingFrame ) { particleEffect.casted = true; Vector3 newPosition = myHitBoxesScript.GetPosition(particleEffect.particleEffect.bodyPart); GameObject pTemp; if (particleEffect.particleEffect.isWeaponTrail) { pTemp = (GameObject)Instantiate(particleEffect.particleEffect.prefab, newPosition, Quaternion.identity); Vector3 endPosition = myHitBoxesScript.GetPosition(particleEffect.particleEffect.bodyPartEnd); pTemp.transform.parent = myHitBoxesScript.GetTransform(particleEffect.particleEffect.bodyPart); XftWeapon.XWeaponTrail xComp = pTemp.GetComponent<XftWeapon.XWeaponTrail>(); xComp.PointStart.position = newPosition; xComp.PointEnd.position = endPosition; } else { newPosition.x += particleEffect.particleEffect.positionOffSet.x * -mirror; newPosition.y += particleEffect.particleEffect.positionOffSet.y; newPosition.z += particleEffect.particleEffect.positionOffSet.z; pTemp = (GameObject)Instantiate(particleEffect.particleEffect.prefab, newPosition, Quaternion.identity); if (particleEffect.particleEffect.stick) pTemp.transform.parent = myHitBoxesScript.GetTransform(particleEffect.particleEffect.bodyPart); } StopParticleDelay spComp = pTemp.GetComponent<StopParticleDelay>(); if (spComp != null) { spComp.stopDelay = particleEffect.particleEffect.duration; } else { Destroy(pTemp, particleEffect.particleEffect.duration); } } }
In XWeaponTrail.cs - replace the Deactivate() method with this one -
public void Deactivate() { gameObject.SetActive(false); if (mMeshObj != null) { mMeshObj.SetActive(false); mVertexPool.SetMeshObjectActive(false); Destroy(mMeshObj); } Destroy(gameObject); }
thnx this was quite helpful how did you do with MoveEditorWindow.cs??
i tried my own.. and i got it work but it ignored mirror to the other side..
i probably did something wrong...
My code uses the z-axis, so mirroring works a bit differently for me.
Ok, this code now needs an update to work with 2.0, as of now, the trails are not visible.
Still stuck on this, the x-weapon trail seems to be getting instantiated, but it isn't visible.
does this work for ufev2
I dont know if this still works in UFE2 but as an alternative, you can just define the Xweapontrail prefabs as bodyparts then control their visibility thru move editor's body part visibility panel.
Universal Fighting Engine Forum → Tips & Articles → (Source) Advanced Tutorial: Hit trails using XWeaponTrail
Powered by PunBB, supported by Informer Technologies, Inc.