-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[TF2] Fixed Beach Ball going Invisible when shot at #1721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This patch fixes the beach ball/Smissmas ornament ball from going invisible by preventing invalid numbers from being used in the math. If invalid numbers are used (for example 0) it catches it and changes it to 1
src/public/jigglebones.cpp
Outdated
| boingSide.NormalizeInPlace(); | ||
|
|
||
|
|
||
| if (data->boingDir.IsZero()) data->boingDir = Vector(0, 0, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a poor way of fixing it, the source of this issue comes from the normalization of the velocity up above, which returns a non-zero result even if the velocity is zero, and it fails the epsilon check as it happens to be bigger than 0.00001f
Higher up on line 591, this will fix it properly:
float speed;
if ( vel.IsZero() )
{
vel = Vector( 0, 0, 1.0f );
speed = 0.0f;
}
else
{
speed = vel.NormalizeInPlace();
speed /= deltaT;
}Included Ficool's better fix
|
Someone has already uploaded a fixed model for the ball that handles this the (probably) correct way, by adding a base bone on the model for which the jigglebone can jiggle relative to; see ValveSoftware/Source-1-Games#4208 (comment) Does this change allow for better handling of jigglebones in general? If not, this probably does not need to go through, in favor of fixing the model itself. Also should probably revert the whitespace changes. |
This is likely to fix other assets other than the ball, therefore this PR is still relevant, besides theres clearly a bug in the code as the check for invalid inputs is not correct |
This is incorrect. I've tested the fix you linked before (which is what led me to actually investigating what caused the bug in the first place) For example the hat "A Rather Festive Tree" also uses the is_boing property. Turning it into a physics prop and shooting it also turns the jigglebones (The ones that use the is_Boing property) from that hat invisible in base TF2. The PR fixes that. Before.is_Boing.Fix.mp4After.is_Boing.Fix.mp4 |
That's odd; why does the model fix work in that case, then? Why does adding the base bone somehow resolve the issue for that particular model? Is it related to skipping some broken logic here if another bone is present? Would be useful to know why exactly that workaround works even if it's not the 'correct' way to fix it. Also it's looking like the ball model should get that base bone anyways in addition to this PR fix, just as a 'correctness' measure, since it seems like without a base bone if another bug crops up with jigglebones this can happen again (based on your video of the Xmas hat folding in on itself instead of outright disappearing, since it has the base bone).
Agreed that this PR should go through then. |

This patch fixes the beach ball/Smissmas ornament ball from going invisible by preventing invalid numbers from being used in the math. If invalid numbers are used (for example 0) it catches it and changes it to 1
To note: While this issue could technically be fixed by preventing the Ball from using the is_boing property, it would also remove the jiggle effect when interacting with the world. My fix preserves both the visibility of the ball when shot as well as the jiggle effect included in the model's QC
Before
before.fix.mp4
After
after.fix.mp4