Godot: How do i get the impulse on collision for a characterbody2D? - Stack Overflow

I'm making a simple 2D space shooter game like asteroids in Godot. The characterbody2D (the ship)

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 :)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744275899a4566327.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信