Hello. I’m trying to tackle the problems with collision and preventing large numbers of sprites from stacking. I see that its has been a recurrent problem from what i’ve read… none of the proposed solutions work well enough… but for the time being i need to understand how to flip enemies that are pathfinding to the player with boids movement without sprite rotation.
I know that the regular “Pathfinding” is
Enemy.Pathfinding::DestinationX()
but what is it for boids? I have
Enemy.Boidsmovement::DestinationX()
but “Destination” isn’t recognized
If you’re talking about flipping the sprite or not so it faces either left or right then you can use the boid expression for velocity X. It’s an expression so you would need to use for each instance and compare 2 numbers.
1 Like
Hey, Thanks. May I ask for flip sprite on the Physics 2.0 behavior instead?
I think I got the collision with many sprites in a top down environment figured out but they still won’t face the player, that’s the only thing left.
I’m alternating the Pathfinding with Physics 2.0 behavior + Separate Objects action and the glitching is set to a minimum to non existent.
Not sure yet on how bad the performance could be mixing and mashing all of these but at least with 50 sprites it retains 60+ FPS
I guess if would be Object.Physics2::LinearVelocityX()
But my thought was to have it face the direction that it was moving.
To face the player, I guess you could compare the X() values. If the object X() is less than the player X() then don’t flip, if it’s greater than then flip it.
Object.Physics2::LinearVelocityX()
I didn’t test it.
Unless you’re disabling and selectively enabling behaviors, I wouldn’t try to mix all of those behaviors.
I tried that but doesn’t seem to work. It flips once but then doesn’t flip anymore. Maybe the pathfinding flip event still on could be affecting though i have it disable momentarily in favor of Physics and vice-versa. I’ll share my events when i get home because this is a too good to drop kind of situation. The collision detection is so good
For reference, New3DModel is the player sprite and there’s the Scene variable “CollisionCount”.
If X on CollisionCount > X variable value increases, then the jumpy hitbox collision glitching also increases but at longer intervals.
I got the flipping working. I just had to add “for every instance of” the enemy. Otherwise only when ALL 50 enemies were to one side then it would flip all at the same time.
This is the best collision I’ve gotten after the failures when diving through all the previous posts on this forum and Reddit. The Pathfinding behavior was clutter after all, I could do without it.
I have no idea why it works. Maybe you can tell me please. There’s some minor jittering when the group of enemies swallows the player, but other than that it’s pretty snazzy.
Edit: Ignore the Timer. It’s doing nothing, remnant of other testing
Does this use 3D? I haven’t used 3D much. If. It’s 3D,I would think that you would rotate it towards the player not flip.
Nope, 2D top down. I was originally using a 3D model in a 2D environment because of sprite “quality” but i eventually figured in my ignorance it was a retarded decision and pointless processing consumption, and converted the 3D model to a spritesheet. I just never changed the character name.
Further testing shows it’s not as great as i thought but it’s still the best of every solution i found here on mass sprite collision. Stress testing with 300, 7 frame animated sprites still keeps 30-35 FPS, which is nice. Drop Shadow effects are ass, though. It consumes so much processing power
Keeping objects apart in GD seems nearly impossible. I’ve ever had success. Although, I haven’t tried much lately.
Is it currently working?
It sure would be nice to able to post video files here or at least GIFs with enough memory they wouldn’t suck so bad to look at.
Here’s a link to a clip i uploaded on imagekit.io:
Collision_Stress_Test
Look for yourself if this is good collision or not, surely better than everything I tried before. As you can see from the last part of the video, they kinda go a bit crazy when the player is in the middle but they barely glitch and never fuse together.