A good example of this is, as mentioned in the title, is how reviving a ghost player and then pushing them, results in them sliding away with any velocity they gained, until they exit the state (they still collide and can get caught on things). Like any applied velocity doesn't deaccelerate to stop on its own, only if colliding with something else, as if the physics component is partially asleep or something.
-- line 396 in player_common_extensions.lua MakeCharacterPhysics(inst, 75, .5)
Doing even a Physics:Stop() call after this prevents it from happening, setting motor velocity also works.
Any case of physics being changed needs to be sanitized to do some sort of physics call afterwards, or this will happen.
Also, something that could maybe be looked into as well, somewhat related to this?
function MakeCharacterPhysics(inst, mass, rad) local phys = inst.entity:AddPhysics() phys:SetMass(mass) phys:SetFriction(0) phys:SetDamping(5) phys:SetCollisionGroup(COLLISION.CHARACTERS) phys:SetCollisionMask( COLLISION.WORLD, COLLISION.OBSTACLES, COLLISION.SMALLOBSTACLES, COLLISION.CHARACTERS, COLLISION.GIANTS ) phys:SetCapsule(rad, 1) return phys end
All of the Make[something]Physics functions will create a new physics engine component for an entities that already have one, rather than modifying things. I think it does get cleaned up, but I'm not sure.. but regardless it's still kinda not the most ideal..?
I know for a fact it does get replaced because I tried storing the one that gets replaced, and then comparing it with the new one, and they're indeed different.
Maybe a new function for the physics component could be made to reset the component back to a clean state as if it was a new one, instead of doing this? Or maybe a lua function, not necessarily on the engine.
- Revive a player who's currently a ghost, with a Telltale Heart or so.
- Walk into them.
- Notice how they'll be pushed but then slide continuously until they exit that state.
-
2
-
1
-
1
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now