private void Fire() { // todo: use ray casting for the bullet transformation and collision //GD.Print("Fire"); // instantiate bullet RigidBody bullet = (RigidBody)bulletscene.Instance(); Spatial bulletspawnpoint = (Spatial)GetNode("Turret/TurretMesh/Gun/BulletSpawn"); Vector3 spawnpos = bulletspawnpoint.GetGlobalTransform().origin; //.GetTranslation() for local space // set position and velocity bullet.SetTranslation(spawnpos); bullet.SetLinearVelocity(turret.GetGlobalTransform().basis.z *bulletspeed); // add to scene GetParent().AddChild(bullet); bullet.Show(); firesound.Play(); EmitSignal("bullet_fired", bullet); }