示例#1
0
    public void SetParticleSpawnInfoValues(GameObject particlePrefab, Actor myActor = null, Animator myAnimator = null)
    {
        actor = myActor;

        if (myAnimator != null)
        {
            parent = myAnimator.transform;

            if (useHumanoidRigLocation)
            {
                parent = myAnimator.GetBoneTransform(humanoidRigLocation);
            }
        }

        if (parent)
        {
            SpawnPosition = parent.transform.position + parent.transform.TransformDirection(PositionOffset);
        }

        if (onGround)
        {
            SpawnPosition  = PhysicsUtilities.FindPointOnGround(SpawnPosition);
            SpawnPosition += new Vector3(0, .01f, 0);
        }

        SpawnRotation = usePrefabRotation ? particlePrefab.transform.rotation : parent.rotation;

        if (worldSpace)
        {
            parent = null;
        }
    }
示例#2
0
    public void Place(Vector3 targetPosition, Quaternion rotation, LayerMask groundLayers, Transform parent = null, bool onGround = false)
    {
        transform.parent = parent;

        if (!onGround)
        {
            transform.position = targetPosition;
        }
        else
        {
            transform.position = PhysicsUtilities.FindPointOnGround(targetPosition, groundLayers);
        }
        transform.rotation = rotation;

        this.gameObject.SetActive(true);
    }