Project crashes when trying to get the position of an object in Vector3

Godot Version

Godot 4


Hello! I am trying to work my way through putting bullets in my game, however when I try to assign their initial position to the barrel of my gun (in this case a raycast3d, in a variable named rifle_raycast), I get the following error:

Invalid get index ‘global_transform’ (on base: ‘Callable’).

the code in question is as follows:

instance = bullet.instantiate
instance.global_transform.origin = rifle_raycast.global_transform.origin
instance.transform.basis = rifle_raycast.global_transform.basis

is there a solution to this issue? do I need to redo this section of code entirely? do you have any tips? answers are all very much appreciated!!!

Try adding instance as child before setting the transform.

hmm, didn’t work. same error.

why the instantiate not the instantiate()?

how do you reference the rifle_raycast? (show the code)
why the error said the rifle_raycast is a Callable?

hi! thanks so much for responding :slight_smile:

i fixed the instantiate() issue, and it immediately fixed itself. guess it really is the small things, huh? thank you very much for pointing that out. have a great day!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.