SOLVED Orient Particles towards direction for a spark particle

Hey, I am trying to make a spark particle that's pretty much just a rectangle. I want it to orient in the direction it's coming from, so pointing in a straight line from its origin point.

In the orientation part of the particle I set it relative to the direction but it seems like it doesn't work and for some reason is slightly random in the angle it starts as. Any help would be greatly appreciated, Thank you!
 
  • Wow
Reactions: Mut

NightFrost

Member
Without seeing your code it is difficult to say where you might be going wrong. In general, if you set the particle's angle the same as its direction, it should always point away from the origin. The unrotated sprite's right edge is aways away from the origin, left is towards the origin. You can set randomized ranges but I assume you've set those to zero, otherwise you wouldn't be asking.
 
//part_type_shape(part_name, pt_shape_line);
//part_type_size(part_name, 0.10, 0.50, 0.01, 0);
//part_type_scale(part_name, 0.30, 0.30);
//part_type_colour1(part_name, 8454143);
//part_type_alpha1(part_name, 0.50);
//part_type_speed(part_name, 2, 2, 0, 0);
//part_type_direction(part_name, 0, 359, 0, 0);
//part_type_orientation(part_name, 0, 359, 0, 0, true);
//part_type_life(part_name, 50, 100);

this is essentially the code I am using, and I am honestly just trying to make it work with one of the presets they have, so just a line. But if you try and use these it just doesn't orient in the correct direction from the origin point. Maybe I'm just really dumb and not seeing something obvious.
 

obscene

Member
First, all your ranges from 0 to 359 should be 0 to 360. That's probably unrelated but still you are missing an entire degree. If you were dealing with integers, 0 to 359 would cover everything, but in real numbers your missing out on angles like 359.50.

Second, how do know the origin point of pt_shape_line or which way it's oriented? I wouldn't trust it to be set up like you need, which is pointing to the right (0) and with the origin at the far right so the tail is pointing at 180 degrees.
 
Thing about the a
First, all your ranges from 0 to 359 should be 0 to 360. That's probably unrelated but still you are missing an entire degree. If you were dealing with integers, 0 to 359 would cover everything, but in real numbers your missing out on angles like 359.50.

Second, how do know the origin point of pt_shape_line or which way it's oriented? I wouldn't trust it to be set up like you need, which is pointing to the right (0) and with the origin at the far right so the tail is pointing at 180 degrees.
I know about the range I didn't care this was just a test really. And It doesn't matter the starting orientation of the pt_shape_line as I was just testing to see if it would go in a predictable angle based on the direction from the angle. I've tried it with a sprite as well we're I set up the origin but it is still not consistently pointing the same direction away from the origin even if the range in direction is only 0.
 

noxx

Member
I think you need to set

part_type_orientation(part_name, 0, 0, 0, 0, true);

Since you set it relative to the direction, this should allign it with the direction without further rotating the sprite.
 
I think you need to set

part_type_orientation(part_name, 0, 0, 0, 0, true);

Since you set it relative to the direction, this should allign it with the direction without further rotating the sprite.
Thank you that was my mistake! It is weird that in the documentation for using part_type orientation it has it written out the way I had it as an example even though you have to set all the values to 0. Thanks tho!
 
Top