public override void _PhysicsProcess(float delta) { _translation = GlobalTransform.Translated(new Vector3(delta * DoorSpeed, 0, 0)); if (_opening && _door.GlobalTransform.origin > _maxTotalTransform.origin) { _door.GlobalTransform = _door.GlobalTransform.Translated(new Vector3(delta * DoorSpeed, 0, 0)); } else if (!_opening && _door.GlobalTransform.origin < _originalTransform.origin) { _door.GlobalTransform = _door.GlobalTransform.Translated(new Vector3(delta * -DoorSpeed, 0, 0)); } }
// Called when the node enters the scene tree for the first time. public override void _Ready() { spaceman = GetParent().GetChild <Spaceman>(0); GlobalTransform = GlobalTransform.Translated(GlobalTransform.origin - spaceman.GlobalTransform.origin + new Vector3(0, verticalDistance, horizontalDistance)); }