So more or less:
void OnHeadbutt() { if (velocity.Y > 0.0f) velocity.Y = 0.0f; }
Seriously, as easy as that! I think there is still an occasional sticking problem, when moving at speed horizontally and jumping into the platform. And I think it might be related to the capsule collision object penetrating the platform enough while the platform is also moving downwards that gravity alone is not enough to move the player entirely out of collision. I need to sift through the (now quite messy) code this evening.
As I said in a previous post, a hacky solution might be to disable collisions between the player and the offending platform for a couple of frames. A more complicated solution might be to track the vertical motion of the platform and the player and compare to see if the player needs to be pushed further. It's what I do to keep the player on the platform when they land on it, so I essentially need to reuse that code (with some refactoring of course) to work downwards instead of upwards.
So anyway, a huge thankyou to James for fixing my code on a Facebook wall post! And apologies in advance. I don't think he realises what he's volunteered himself for.
I wonder if he keeps his phone number on his Facebook profile?
Programmers are usually awake at 2am, right?
CLICK HERE FOR THE MOST RECENT TODO LIST
No comments:
Post a Comment