0 votes

Hi, i'm making a sport game, like a dodge ball game, i need help with the ball physics, how do i make it damage the player when it hits, depending on the impulse of the physics force?

Godot version 3.2.3
in Engine by (15 points)

1 Answer

+1 vote
Best answer

RigidBody2D has a property called linear_velocity which returns a Vector of how fast your RigidBody2D object is moving.

Just use the Pythagorean formula if you want the c

var c =  sqrt((linear_velocity.x * linear_velocity.x) + (linear_velocity.y * linear_velocity.y))
by (378 points)
selected by

use linear_velocity.length() is simpler.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.