Skip to content
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

Improve grab-throw #24

Open
RailKill opened this issue Oct 31, 2021 · 1 comment
Open

Improve grab-throw #24

RailKill opened this issue Oct 31, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@RailKill
Copy link
Owner

Currently, grabbable objects are switched to RigidBody.MODE_CHARACTER whenever grabbed in order to attach the object to the hand, but this interferes with the normal RigidBody physics of that object. This is alright, but the implementation for the throw() part of the code applies an artificial force to the RigidBody upon release (upon switching back to RigidBody mode), rather than actually letting the RigidBody gain its velocity normally. This causes some throws to look weird and have an unnatural trajectory.

The solution should be to never change the RigidBody mode of the grabbed object, and instead change its transform.origin via _integrate_forces() to modify its position in the PhysicsState. Another possible solution would be to simply perform better calculations on the hand trajectory and factor that into the artificial application of velocity. I prefer the former.

@RailKill RailKill added the enhancement New feature or request label Nov 5, 2021
@RailKill
Copy link
Owner Author

RailKill commented Nov 5, 2021

Be wary that the reason why MODE_CHARACTER was chosen in the first place was also to completely circumvent collision with the player's body. Making it use the normal rigid body state would then require the collision layers to be tweaked so that it doesn't collide with the player's body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant