#Smoke Triggers Player

1 messages · Page 1 of 1 (latest)

plucky cliff
#

:)

wind pasture
#

What the heck how did this happen

plucky cliff
#

click any message in discord, create thread

wind pasture
#

wat dang that's awesome

plucky cliff
#

yeah, less clutter

#

so just re-define your entire issue here
State what you are trying to achieve

#

post code and inspector stuff

wind pasture
#

would you like git?

plucky cliff
#

nah

wind pasture
#

mkay

plucky cliff
#

just make it easy for people to pick up on the issue in the thread

wind pasture
#

ya

plucky cliff
#

afk a bit

wind pasture
#

np i greatly appreciate the help.

#

The player OnTriggerEnter2D is not detecting the particle triggers shown here. I'm simply trying to get the triggers to flip a bool on the player for now.

#

Here's the trigger module on the particle system

#

I decided instead of a write up I was going to make a few copies with different settings, put debug logs in all potential methods on player, and try a bit more

plucky cliff
#

I have an idea

#

are you working with 2D or 3D colliders, or both?

#

If I recall correctly, 2D and 3D cannot interact with one another

#

Particle System can be set to 2D, but I forget how

#

try Burst Spread in the Emission module

#

or just add a 3D collider to the player

wind pasture
#

I actually noticed this. Collision has 2D option, trigger does not. Trigger shows spheres as you point out.

#

already using 2d collider for tilemap tho

plucky cliff
#

should be safe to add a 3D Collider with isTrigger true to the player

#

you might want 3D particles anyway

wind pasture
#

unity litearlly won't allow it

plucky cliff
#

screenshot all components?

#

collapse them so they fit in one screen

wind pasture
#

it dun like the rigidbody2d, which i don't think is necessary tbh

plucky cliff
#

There should be a simple solution to this.
Like making the Particles 2D
or you can create a child game object with a 3D collider
but maybe try OverlapCapsule

#

should be a quick fix

wind pasture
#

I'll try that next thanks

plucky cliff
#
using UnityEngine;

public class DeltaCounter : MonoBehaviour
{
    private float frequency = 1.0f;
    private float timer;

    private void Update()
    {
        timer += Time.deltaTime;

        if (timer >= frequency)
        {
            timer = 0f;
            MyFunction();
        }
    }

    private void MyFunction()
    {
        // Hello, World!
    }
}

That there is a good way to not run heavy functions each and every visual frame

#

it's like a Coroutine, but without the added background garbage

#

frequency is how often you want it to run

#

every 1.0f sec

wind pasture
#

yeah that's how I did my over time methods for the fog degen / regen

#

i couldn't figure out the overlap collider thing

#
using System.Collections.Generic;
using UnityEngine;

public class PlayerStats : MonoBehaviour
{
    public int _smokeBuildup = 0;
    public bool _smokeBool = false;
    private float _reductionRate = 1;
    private float _damageRate = 1;
    private float _timer;

    

    private void Update()
    {
        if (_smokeBool = false && _smokeBuildup > 0)
        {
            SmokeReduction();
        }
        
        if (_smokeBool == true)
        {
            SmokeDamage();
        }
    }




    //Desperately trying to get smoke to register xd



    private void OnTriggerEnter2D(Collider2D col)
    {
        Debug.Log("Collider Entered!");
        if (col.tag == "Smoke")
            Debug.Log("smoked!");
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        Debug.Log("Collision Detected!");
    }

    private void OnParticleTrigger()
    {
        Debug.Log("Trigger Detected!");
    }
    //reduce smoke buildup over time if not colliding
    public void SmokeReduction()
    {
        //Why can't this _timer variable be local? Just curious.
        _timer += Time.deltaTime;

        if (_timer >= _reductionRate)
        {
            _timer = 0f;
            _smokeBuildup--;
            Debug.Log("Smoke Building Up: " + _smokeBuildup);
        }
    }
    //increase smoke buildup over time 
    public void SmokeDamage()
    {
        _timer += Time.deltaTime;

        if (_timer >= _damageRate)
        {
            _timer = 0f;
            _smokeBuildup++;

            Debug.Log("Smoke Reducing: " + _smokeBuildup);

        }
    }
}
#

not sure exactly how I'd put it in there

plucky cliff
#

hmm

#

try this

#

go to Particle System -> Collision

#

What is the Collision Mode ?

#

hm wait, it's different now

#

and reminding myself - trigger, not collider

wind pasture
#

yeah. Though the player pushing the emission around is kinda cool

plucky cliff
#

kk

wind pasture
#

but yeah, trigger not collision

#

xd

#

I'm really surprised it's this hairy tbh

plucky cliff
#

I spent weeks before trying to comprehend the particle system

#

just wait till you get to VFX Shader Graph 🤣

#

I have not used it yet, but it's as beautiful as it is complex

wind pasture
#

I been using both SG and VFX a bit tbh

#

I like the VFX graph

#

easier to comprehend

#

xd

plucky cliff
#

lol

#

good to hear

#

I have too many different things on my mind.
Looking forward to some nice caffeinated evenings with VFX

#

once I have other stuff in order

#

yes, me helping people is me procrastinating my own problems
but for now it's constructive ^^

wind pasture
#

It's beautiful tbh, the vfx stuff

plucky cliff
#

yeah I know, I just hope it also runs well

#

would hate to waste 10 hrs only having to make it 1/10th complex later

wind pasture
#

I'm on integrated intel laptop graphics and had 1000000 particles goin

plucky cliff
#

wow, nice

wind pasture
#

ye

plucky cliff
#

there is hope

wind pasture
#

was making silly ball things galaxy things

plucky cliff
#

dark magic to destroy stuff, good times

wind pasture
#

the graph tho for connecting all the ways you want things to go is so niiice

plucky cliff
#

yeah it's like Bolt, visual scripting

#

seems more effective to do it that way as well

wind pasture
#

I play with midi data in unity

#

so a software playing drums, or turning synthesizer knobs, also is my data for VFX variables

#

SUUUUPER fun.

#

anywho. i'll bbl. I think i'm gonna nap

#

or sleep all day tbh

#

i'm nocturnal now 😿

plucky cliff
#

Sounds interesting, like you could make your own music visualizations
I think I'll look into that some time ^^

#

Let me know if you find a solution to this thing. I want to write it down 😂

wind pasture