c# finding it hard to access the transforms of instanced objects (Nodes?)

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

Hi I’m new to godot and got some GDscripts running ok, but want to use c#.
(It’sworth it for me, as I’ve built big games in c#, and just don’t get on with python/lua derivatives)
I’m finding it very hard, particularly to get instantiating right, as it seems that instantiate throws you a node back, but Nodes seem not to have any access to a transform.

eg:

void _fire() {
if (prefab != null) {
Node vBullet = prefab.Instance() ;
GetTree().GetRoot().AddChild(bullet);
bullet.Translation =GlobalTransform.origin;
bullet.Rotation = (GlobalTransform.basis.GetEuler());
bullet.fwd = new Vector3(0, 0, -1);

	}
}
:bust_in_silhouette: Reply From: juppi

Hi,

you can use the method with a Generic type parameter:

prefab.Instance<Spatial>() ;

Now you should have access to Translation or Rotation.