how could i override the apply_impulse() function?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By random_developer

I was making a shot system using the bullet as packed_scene

when trying to put the apply_impulse() function in a rigidbody2d (the bullet), I get the error:

invalid call. Nonexistent function 'apply_impulse' in base 'PackedScene'

I’m using godot 3.5.1, apparently, apply_impulse() is no longer supported by the engine… what’s the best way to override this function?

:bust_in_silhouette: Reply From: SteveSmith

It is available, but you are trying to call it on a PackedScene, not the actual scene. Without seeing the rest of your code it’s difficult to be certain, but you probably need something like this at the start:

var bullet = PackedScene.instance()
bullet.apply_impulse(...)

but…apply_impulse is no longer supported on godot 3.5.1

random_developer | 2022-12-11 17:22

thanks for the documentation

random_developer | 2022-12-11 18:39