コード例 #1
0
    public override void _PhysicsProcess(float delta)
    {
        if (_currentlyPlacingBuilding == null)
        {
            return;
        }
        var spaceState   = GetWorld().DirectSpaceState;
        var intersection = spaceState.IntersectRay(
            _cameraController.GetPickingRayPosition(),
            _cameraController.GetPickingRayEnd(50),
            null,
            1 << 4);

        if (intersection.Count > 0)
        {
            var localPosition = (Vector3)intersection["position"] - GlobalTransform.origin;

            _currentlyPlacingBuilding.MoveTo(new Vector3(Mathf.Floor(localPosition.x), 0.0f, Mathf.Floor(localPosition.z)));
        }
    }
コード例 #2
0
 public void MoveTo(IPosition pos) => Building.MoveTo(pos);