admin管理员组文章数量:1401149
I'm making a simple 2D space shooter game like asteroids in Godot. The characterbody2D (the ship) floats in space until it hits a wall (a staticbody2D)- this will be the only thing it collides with. I'm using move_and_collide(), and a simple bounce script on collision.
I want to implement a system that detects the force of the collision, and punishes the player based on just how strong the collision was. Low speed collisions shouldn't count, but high speed collisions at a steep angle should. I can't just use the velocity of the player before impact, as the collision might have been just a slight glance off a wall at high speeds. I need to find a way to access Godot's understanding of the collision- if there is some way to get the impulse created by the characterbody in a collision, that would be perfect. Otherwise, I may have to learn some math and find the right way to calculate the balance between velocity and angle of impact...
I learned about kinematiccollision2D, but none of the accessible info in it helps me get the impulse created on impact, only the angle and the velocity before and after. I hope I'm missing something here, please help :)
本文标签: Godot How do i get the impulse on collision for a characterbody2DStack Overflow
版权声明:本文标题:Godot: How do i get the impulse on collision for a characterbody2D? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744275898a2598409.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论