6
u/SeaMango1064 18d ago
Aside from the fact that you could factor some stuff out (like nest the xPosOfLastCollision != object.vertices[i][0] clause, which would then let you factor out the calculations), the code seems fine to me lmao
Definitely I've worked on codebases with diabolical amounts of inheritance and object-oriented nightmare-fuel so this is pretty quaint in comparison 😅
1
u/RenderTargetView 17d ago
There is also lack of DeltaTime multiplier in numerical integration in the beginning, if this code is not running inside a fixed-step loop in separate physics thread this would lead to time being accelerated by your fps like in old games. Also numerical integration lacks gravity term in position equations - you use velocity from beginning of your time step but it changes during your time step
10
u/YysrID4gYW55IG90aGVy 23d ago
Isn’t and the binary and in C++?
35
u/_Ilobilo_ 22d ago
what?
10
u/YysrID4gYW55IG90aGVy 22d ago
In C++ you have the binary and & as well as the logical and &&. and is also a keyword and I believe it’s the binary, not the logical.
27
u/_Ilobilo_ 22d ago
&& and "and" are both logical. bitwise & is "bitand"
6
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" 21d ago
Was just going to say no, but I forgot the alternative for '&'.
2
u/throw3142 18d ago
C++ has an "and" keyword? I got through 2 degrees without knowing this. Why is C++ like this, wtf??
4
u/YysrID4gYW55IG90aGVy 18d ago
Yes, it has even more: https://en.cppreference.com/cpp/language/operator_alternative
3
3
u/Probable_Foreigner 11d ago
I love this example so much:
bool operator not_eq(const X bitand other) <% return this not_eq bitand other; %>So
return this not_eq bitand other;looks like word salad but actually meansreturn this != &other;, as in the parameter is not the same address as the "this" instance.1
12
u/TingleWizard 18d ago
Nice game of spot the difference.