Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

would be interested in any updated information you can provide!

"Battle Hard" - Trilateral

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

I should have something ready to share over the weekend smile

Share

Thumbs up +1 Thumbs down

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

cool!

"Battle Hard" - Trilateral

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

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);
        }

Share

Thumbs up +1 Thumbs down

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

Steviebops wrote:

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...

Share

Thumbs up Thumbs down

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

My code uses the z-axis, so mirroring works a bit differently for me.

Share

Thumbs up Thumbs down

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

Ok, this code now needs an update to work with 2.0, as of now, the trails are not visible.

Share

Thumbs up Thumbs down

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

Still stuck on this, the x-weapon trail seems to be getting instantiated, but it isn't visible.

Share

Thumbs up Thumbs down

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

does this work for ufev2

Share

Thumbs up Thumbs down

Re: (Source) Advanced Tutorial: Hit trails using XWeaponTrail

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.

Share

Thumbs up +2 Thumbs down