Tag Info

New answers tagged

0

You should do a bounds check as you mentioned then reduce the velocity so you don't get shaky behavior. You kind of got it but I'm not sure what displacement does. //This code goes after velocity is set if (position.x > 50) { position.x = 50; //If we're heading towards the bounds, stop if (velocity.x > 0) velocity.x = 0; } else if ...


0

replace your whole if-statement with this: float vstep = step( u_bgColor.r, texColor.r); texColor.a = mix(0.1, u_lightIntensity/10.0, vstep); mix will select either the 1st argument of the mix if vstep == 0, or the 2nd otherwise (which is vstep == 1)


1

I have a couple of suggestions Avoid Allocations and Copies A lot of your code has unnecessary allocations and copies. Instead of filling a vector with push_back, try pre-allocating the vector and setting the data there. You have a fixed maximum number of intersection points, so pre-allocate a vector of that size. Do a Simple Broadphase Before you do ...



Top 50 recent answers are included