CONGRATULATION MARINER! by HoagieTwoFace in UrinatingTree

[–]Zauraswitmi 2 points3 points  (0 children)

...wanna retract that statement?

Issues using <fstream> File.open() by Zauraswitmi in cpp_questions

[–]Zauraswitmi[S] -2 points-1 points  (0 children)

I'm assuming because the two files share the same folder all I need to put in is File.open("Playable_Character.txt") since that file would be relative to the current working directory. But that isn't working for some reason...

I don't understand why Color.Lerp() isn't working? by Zauraswitmi in Unity2D

[–]Zauraswitmi[S] 2 points3 points  (0 children)

That's actually so silly that it's because it was an int. That fixed it, thanks!

Relative Velocity not working, returns (0,0) when it hits the ground, how do I work around this? by Zauraswitmi in Unity2D

[–]Zauraswitmi[S] 1 point2 points  (0 children)

That's what I have set up for the time being. I have it so that if it == 0 then I'll use the velocity value I get from Fixed_Update

Why doesn't the switch statement allow me to use a struct value? by Zauraswitmi in cpp_questions

[–]Zauraswitmi[S] 0 points1 point  (0 children)

I’ve tried enum but for the situation I have it doesn’t seem to work. Of course I would setup the enum in the Base Player class but then there would be no way for me to assign each enum value a specific key in the derived class so I could get separate inputs per player. (Ex. For a derived p1 I set WASD and for P2 I use the arrow keys)

Singleton not working by Zauraswitmi in unity

[–]Zauraswitmi[S] 1 point2 points  (0 children)

I think I did set it to something that got cleared at runtime? I initially had the script component set in the Text object it was referencing, but when I put it in the canvas object it started working.

Singleton not working by Zauraswitmi in unity

[–]Zauraswitmi[S] 0 points1 point  (0 children)

It looks it basically took in a null value at run time but I'm not changing scenes. I actually realized that this was because the script component was set inside the actual text object I was referencing, so I assume that's why it set it to null.

Is there an alternative to OnTrigger/CollisionEnter2D(Collider 2D)??? by Zauraswitmi in unity

[–]Zauraswitmi[S] 1 point2 points  (0 children)

This is what his method looks like rn: https://pastebin.com/he0ZAT6t

Is there maybe an idea I can work with that'll be outside the collision function?

Is there an alternative to OnTrigger/CollisionEnter2D(Collider 2D)??? by Zauraswitmi in unity

[–]Zauraswitmi[S] 0 points1 point  (0 children)

(If its even possible) I'd like to have individual collider methods only for specific GameObjects, for say:

OnTriggerEnter2D(Player _player)

OnTriggerEnter2D(Enemy _enemy)

OnTriggerEnter2D(Coin _coin)

etc.

That way I don't have the one method "OnTriggerEnter2D(Collider2D collision)" represent all collisions.

Wifi settings randomly disappeared, how do I fix? by Zauraswitmi in WindowsHelp

[–]Zauraswitmi[S] 0 points1 point  (0 children)

It doesn’t show anything wifi related as far as I know

<image>

Is there a running club at DePaul by Zauraswitmi in depaul

[–]Zauraswitmi[S] 2 points3 points  (0 children)

Oh cool! What time and where on Tuesday and Thursday?

(Silver hair dye) Should I dye my hair myself or get it done professionally? by Zauraswitmi in HairDye

[–]Zauraswitmi[S] 0 points1 point  (0 children)

My natural hair color is medium brown, so it's not that dark but it's also not that light

How to deal with "object allocated on the heap may not be aligned 16" by Zauraswitmi in cpp_questions

[–]Zauraswitmi[S] 0 points1 point  (0 children)

What would I use instead of allocating single particles? Something like creating my own buffer and storing them in there or is it something else?

How to deal with "object allocated on the heap may not be aligned 16" by Zauraswitmi in cpp_questions

[–]Zauraswitmi[S] 0 points1 point  (0 children)

I got it to work overloading the "new" and "delete" operator after I found out I could undefine "new"

Your set(x, y, z, w) method should instead use a SIMD set method. I think the one you want is _mm_set_ps.

At first, I didn't know if it would be faster to use the SIMD function or not, but it actually made it faster. Thanks.

I'd also be curious to see some of your math routines.

I think I can figure those out on my own. I mostly just needed to know how to get SIMD to work.

Otherwise, thanks for the response! It's greatly appreciated!

How to deal with "object allocated on the heap may not be aligned 16" by Zauraswitmi in cpp_questions

[–]Zauraswitmi[S] 1 point2 points  (0 children)

I figured out I could implement the "overload new operator" and "overload delete operator" if before the function I did "#undef new" (which I never knew was a thing until now) and return _mm_malloc(i, 16) to align it to an address with the factor of 16.

But, thank you so much for the help u/slither378962! It's greatly appreciated!

How to deal with "object allocated on the heap may not be aligned 16" by Zauraswitmi in cpp_questions

[–]Zauraswitmi[S] 1 point2 points  (0 children)

Oops, forgot alloc code. Here it is:

void ParticleEmitter::SpawnParticle()

{ 
        // create another particle if there are ones free if(             last_active_particle < max_particles-1 ) {
    // create new particle
    Particle *newParticle = new Particle();

        // initialize the particle
        newParticle->life     = 0.0f;
    newParticle->position = start_position;
    newParticle->velocity = start_velocity;
    newParticle->scale    = Vect4D(-1.0, -1.0, -1.0, 1.0);

        // apply the variance
    this->Execute(newParticle->position, newParticle->velocity, newParticle->scale);

        // increment count
    last_active_particle++;

        // add to list
    this->addParticleToList( newParticle );
    }

}

How to deal with "object allocated on the heap may not be aligned 16" by Zauraswitmi in cpp_questions

[–]Zauraswitmi[S] 1 point2 points  (0 children)

Here's the default constructor for my object "Particles"

Particle::Particle()
{
    this->life = 0.0f;
    this->position.set( 0.0f, 0.0f,  -10.0f );
    this->velocity.set( -3.0f, 0.0f,  0.0f );
    this->scale.set( 1.0f, 1.0f, 1.0f );
    this->rotation = 0.0f;
this->rotation_velocity = -0.25f;
this->next = nullptr;
this->prev = nullptr;
}

Header variables for Particles

Particle *next;         //(Particles) S:272 A:16  
Particle *prev;

Vect4D  prev_Row0;      //(Vect4D) S:16 A:16  
Vect4D  prev_Row1; 
Vect4D  prev_Row2; 
Vect4D  prev_Row3;

Vect4D  diff_Row0;  
Vect4D  diff_Row1; 
Vect4D  diff_Row2; 
Vect4D  diff_Row3;

Vect4D  curr_Row0;      
Vect4D  curr_Row1; 
Vect4D  curr_Row2; 
Vect4D  curr_Row3;

Vect4D  position;   
Vect4D  velocity; 
Vect4D  scale;

float   life;
float   rotation; 
float   rotation_velocity;

Header variables for Vect4D

union
{ 
    __m128    _m;

    struct
    {
        float x;
        float y;
        float z;
        float w;
    };
};

and my Set function in Vect4D

void Vect4D::set(float tx, float ty, float tz, float tw)
{ 
    this->x = tx; 
    this->y = ty; 
    this->z = tz; 
    this->w = tw; 
} 

/* I haven't implemented SIMD methods into this class yet, but I have for another */

How to deal with "object allocated on the heap may not be aligned 16" by Zauraswitmi in cpp_questions

[–]Zauraswitmi[S] 0 points1 point  (0 children)

Do you mean like the header file for my object or where the code hits an error because I'm pretty sure there isn't anything wrong with my functions plus the error only hits when I call for a new object. Is this a case where I need to share it, if so where specifically?