I keep trying to use it but an error says that the node does not contain a definition for it.
How do i use the apply_impulse method?
Asked Answered
apply_impulse
is a method on Rigidbody2D and RigidBody3D.
If you create a new scene chose one of these for objects you want to apply impulses too or make your script extend from Rigidbody2D/3D
class_name ExampleName extends Rigidbody3D
https://docs.godotengine.org/en/stable/classes/class_rigidbody2d.html
https://docs.godotengine.org/en/stable/classes/class_rigidbody3d.html
Example:
class_name Ball extends RigidBody3D
func throw(direction: Vector3):
apply_central_force(direction * 300) # or in your case impulse
class_name is optional
Shiva Sorry, I always overlook the CSharp tag.
But the rigidbody part should also apply for this.
Shiva Thanks!
© 2022 - 2024 — McMap. All rights reserved.