Laster hit cast

Shadowing

Member
Not sure why but my laser doesnt hit anything. works on the demo though I looked at the weapon and mine is setup the same. Unless there is a setting I'm not seeing.

Under CasterModuleGroup -> Simple Caster
Detect Layer. I even try setting it to Everything. I have a barrel set to Doodad and Tent set to default. it just goes through those.

The laser just go throughs all solid objects.
Also impact effect doesnt work but thats cause its probably not detecting a hit. I notice on the demo there is no hit effect though.

I'm at a loss here idk.
 
This is how the laser effect should really look Justin except the effect should end sooner. I have a object with its own code running that spawning the effect using your toggle on and off option.
Anyways you can see how the raycast isnt working at all for impact. idk what the hell.
I'll put a debug raycast line on it later see where its going i guess.

My character seems fine all child elements are all pointed forward.


 
I can't figure out why this event doesn't fire.
Tried using the Character main object for obj argument and the weapon item game Object.

Code:
using Opsive.Shared.Events;
using Opsive.UltimateCharacterController.Items;
using UnityEngine;

public class LaserController : MonoBehaviour
{
    public GameObject Character;
    public GameObject LaserEffect;

    protected void Awake(){

        EventHandler.RegisterEvent<CharacterItem>(Character, "OnMagicItemCast", OnMagicItemCast);
        
    }


    void OnMagicItemCast(CharacterItem characterItem ){

        LaserEffect.SetActive(true);
    }
}
 
I moved the script to Main Character root and now it works. I don't understand, Character is the main Character root.
 
That's the particle stream, correct? You could try taking the prefab from the demo scene and bringing it into your own scene to test.

I moved the script to Main Character root and now it works. I don't understand, Character is the main Character root.
My guess is that the references are different in your first parameter. The EventHandler is a static object and it only knows about the arguments that you input, not the location of the script.
 
ya i copied the particle stream prefab when I made my laser. anyways I added particle stream to my character same issue. Even the particle effect goes right through all objects. Its like its ignoring raycast or racast isnt firing forward. Didnt have any issues with UCC2 on this.
 
You can debug this by setting a breakpoint within TargetImpact.DoCastInternal. This is the raycast that determines the hit object.
 
Well no wonder it never gets called

3017 Execute OnAnimatorItemUse on GameObject Shadowing.
3110 Execute OnAnimatorItemUseComplete on GameObject Shadowing.

Code:
        /// <summary>
        /// Performs the cast.
        /// </summary>
        /// <param name="useDataStream">The use data stream, contains the cast data.</param>
        protected override void DoCastInternal(MagicUseDataStream useDataStream)
        {
            m_DrawGizmos = true;

            m_CastID = (uint)useDataStream.CastData.CastID;
            m_Direction = useDataStream.CastData.Direction.normalized;
            m_Origin = useDataStream.CastData.CastTargetPosition - m_Direction.normalized * 0.1f;
            m_Distance = m_Direction.magnitude + 0.1f;
  Debug.Log("Casted");
            if (Physics.Raycast(m_Origin,m_Direction, out var hit, m_Distance, useDataStream.CastData.DetectLayers)) {
                MagicAction.PerformImpact(m_CastID, GameObject, hit.transform.gameObject, hit);
            }
        }
 
Top